/* Contents Layout */
#contents {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    width: 100%;
}

.contents_inline {
    display: flex;
    justify-content: center;
}

.contents_m {
    width: 100%;
    max-width: 900px;
}

/* Page Title */
.contents_m>h2 {
    font-size: 2.2rem;
    color: var(--gray-dark);
    margin-bottom: 1.5rem;
    font-weight: 700;
    text-align: center;
    position: relative;
}

.contents_m>h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(135deg, var(--main-color) 0%, var(--button-color) 100%);
    border-radius: 2px;
}

/* Sub Menu */
.sub_menu {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
    list-style: none;
}

.sub_menu li {
    margin: 0;
}

.sub_menu a {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--button-color) 0%, #d66013 100%);
    color: var(--white);
    text-decoration: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 3px 10px rgba(234, 115, 23, 0.3);
    cursor: pointer;
}

.sub_menu a:hover {
    background: linear-gradient(135deg, #d66013 0%, #c55511 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(234, 115, 23, 0.4);
}

.sub_menu a:active {
    transform: translateY(0);
}

/* Main Container */
.main {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(135deg, var(--main-color) 0%, var(--button-color) 100%);
}

.main:hover {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Empty State Message */
.main p {
    color: var(--gray);
    font-size: 1.2rem;
    text-align: center;
    padding: 3rem 2rem;
    line-height: 1.8;
    position: relative;
}

.main p::before {
    content: '📋';
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* If there would be history items, style them */
#history_items .history_item {
    border-bottom: 1px solid var(--gray-light);
    padding: 1.5rem 2rem;
    transition: var(--transition);
}

#history_items .history_item:last-child {
    border-bottom: none;
}

#history_items .history_item:hover {
    background: rgba(36, 95, 229, 0.02);
    transform: translateX(4px);
}

#history_items .history_title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-dark);
    margin-bottom: 0.5rem;
}

#history_items .history_title a {
    color: var(--main-color);
    text-decoration: none;
    transition: var(--transition);
}

#history_items .history_title a:hover {
    color: var(--button-color);
}

#history_items .history_meta {
    color: var(--gray);
    font-size: 0.9rem;
}

#history_items .history_date {
    color: var(--gray);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Alternative styling for when there are items */
#history_items:not(:empty) {
    padding: 1rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    #contents {
        padding: 1rem;
    }

    .contents_m>h2 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .sub_menu {
        justify-content: center;
        margin-bottom: 1rem;
    }

    .sub_menu a {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }

    .main p {
        font-size: 1.1rem;
        padding: 2rem 1.5rem;
    }

    .main p::before {
        font-size: 2.5rem;
    }

    #history_items .history_item {
        padding: 1.25rem 1.5rem;
    }

    #history_items .history_item:hover {
        transform: none;
    }
}

@media (max-width: 480px) {
    .contents_m>h2 {
        font-size: 1.5rem;
    }

    .main p {
        font-size: 1rem;
        padding: 1.5rem 1rem;
    }

    .main p::before {
        font-size: 2rem;
    }

    #history_items .history_item {
        padding: 1rem 1.25rem;
    }

    #history_items .history_title {
        font-size: 1rem;
    }

    .sub_menu a {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

/* Animation for page load */
.main {
    animation: fadeInUp 0.8s ease-out;
}

.contents_m>h2 {
    animation: fadeInDown 0.6s ease-out;
}

.sub_menu {
    animation: fadeInRight 0.7s ease-out 0.2s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Enhanced empty state */
.main:empty::after {
    content: '最近見た案件はありません';
    color: var(--gray);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
}

.main:empty::before {
    content: '📋';
    font-size: 3rem;
    opacity: 0.3;
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
}

/* JavaScript interaction feedback */
.sub_menu a:focus {
    outline: 2px solid var(--main-color);
    outline-offset: 2px;
}

/* Loading state for when history is being deleted */
.main.loading {
    opacity: 0.7;
    pointer-events: none;
}

.main.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 3px solid var(--gray-light);
    border-top: 3px solid var(--main-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Smooth transitions for dynamic content */
#history_items>* {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#history_items.updating>* {
    opacity: 0.5;
    transform: translateX(-10px);
}