/* Popup Overlay */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.popup-overlay.active {
    display: flex;
    opacity: 1;
    justify-content: center;
    align-items: flex-end;
    padding: 0;
}

/* Popup Container - Mobile First */
.popup-container {
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
}

.popup-overlay.active .popup-container {
    transform: translateY(0);
}

/* Popup Header */
.popup-header {
    padding: 20px 20px 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    position: relative;
    flex-shrink: 0;
}

.popup-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
}

.popup-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.popup-close {
    background: #f3f4f6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.popup-close:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Palace Info Section */
.palace-info {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.palace-info-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px 4px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    min-height: 50px;
}

.palace-info-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.palace-info-value {
    color: #dc2626;
    font-weight: 700;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
}

/* Main Tabs */
.popup-tabs {
    display: flex;
    background: white;
    padding: 0 20px;
    border-bottom: 1px solid #f0f0f0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-shrink: 0;
}

.popup-tabs::-webkit-scrollbar {
    display: none;
}

.popup-tab {
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-size: 0.95rem;
    min-width: fit-content;
}

.popup-tab:hover {
    color: #374151;
}

.popup-tab.active {
    color: #dc2626;
    border-bottom-color: #dc2626;
    font-weight: 600;
}

/* Popup Content */
.popup-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fafafa;
}

.tab-content {
    display: none;
    flex: 1;
    overflow: auto;
    padding: 20px;
    flex-direction: column;
}

.tab-content.active {
    display: flex;
}

/* Sub Tabs */
.sub-tabs {
    display: flex;
    margin-bottom: 16px;
    background: white;
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-shrink: 0;
}

.sub-tabs::-webkit-scrollbar {
    display: none;
}

.sub-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    white-space: nowrap;
    min-width: fit-content;
}

.sub-tab:hover {
    color: #374151;
    background: #f9fafb;
}

.sub-tab.active {
    color: white;
    background: #dc2626;
    font-weight: 600;
}

.sub-content {
    display: none;
    flex: 1;
    overflow: auto;
}

.sub-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Tables */
.popup-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    table-layout: fixed;
    flex-shrink: 0;
}

.popup-table th {
    background: #dc2626;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popup-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    line-height: 1.5;
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.popup-table tr:last-child td {
    border-bottom: none;
}

.popup-table tr:hover {
    background: #fef2f2;
}

.popup-table td:first-child {
    font-weight: 600;
    color: #dc2626;
    background: #fef2f2;
    width: 30%;
    min-width: 120px;
}

.popup-table td:nth-child(2) {
    width: 70%;
}

/* Special styling for content cells */
.popup-table td:not(:first-child) {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Description Area */
.description-area {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
    min-height: 100px;
    color: #374151;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.description-area strong {
    color: #dc2626;
    font-size: 1.05rem;
}

/* Two Section Layout for Tab 3 */
.two-section-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Desktop Styles */
@media screen and (min-width: 769px) {
    .popup-overlay.active {
        align-items: center;
        padding: 20px;
    }
    
    .popup-container {
        border-radius: 16px;
        width: 1000px;
        max-width: 90vw;
        height: 700px;
        max-height: 90vh;
        transform: scale(0.9);
    }
    
    .popup-overlay.active .popup-container {
        transform: scale(1);
    }
    
    .popup-header::before {
        display: none;
    }
    
    .popup-header {
        padding: 24px 28px 20px 28px;
    }
    
    .popup-title {
        font-size: 1.5rem;
    }
    
    .palace-info {
        padding: 16px 28px;
        font-size: 0.9rem;
        gap: 12px;
    }
    
    .palace-info-item {
        padding: 16px 8px;
        min-height: 60px;
    }
    
    .palace-info-value {
        font-size: 1.3em;
    }
    
    .popup-tabs {
        padding: 0 28px;
    }
    
    .popup-tab {
        padding: 14px 24px;
        font-size: 1rem;
    }
    
    .tab-content {
        padding: 28px;
    }
    
    .sub-tabs {
        padding: 6px;
        margin-bottom: 20px;
    }
    
    .sub-tab {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    
    .popup-table th:first-child,
    .popup-table td:first-child {
        width: 15%;
    }
    
    .popup-table th:nth-child(2),
    .popup-table td:nth-child(2) {
        width: 35%;
    }
    
    .popup-table th {
        padding: 10px 18px;
        font-size: 0.85rem;
        line-height: 1.2;
    }
    
    .popup-table td {
        padding: 12px 18px;
        font-size: 0.9rem;
        line-height: 1.5;
    }
}

/* Tablet Styles */
@media screen and (max-width: 768px) and (min-width: 481px) {
    .popup-container {
        width: 95vw;
        height: 90vh;
        border-radius: 16px;
    }
    
    .popup-overlay.active {
        align-items: center;
        padding: 20px;
    }
    
    .popup-overlay.active .popup-container {
        transform: scale(1);
    }
    
    .popup-header::before {
        display: none;
    }
    
    .palace-info {
        gap: 10px;
        font-size: 0.8rem;
    }
    
    .palace-info-item {
        padding: 14px 6px;
        min-height: 55px;
    }
    
    .popup-table th:first-child,
    .popup-table td:first-child {
        width: 35%;
    }
    
    .popup-table th:nth-child(2),
    .popup-table td:nth-child(2) {
        width: 65%;
    }
    
    .popup-table td {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
    
    .popup-table th {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
}

/* Mobile Styles */
@media screen and (max-width: 480px) {
    .popup-container {
        border-radius: 20px 20px 0 0;
        width: 100%;
        height: 85vh;
        max-height: none;
        max-width: none;
    }
    
    .popup-header {
        padding: 16px 20px 12px 20px;
    }
    
    .popup-title {
        font-size: 1.1rem;
    }
    
    .popup-close {
        width: 28px;
        height: 28px;
        font-size: 1.1rem;
    }
    
    .palace-info {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 6px;
        padding: 8px 20px;
        font-size: 0.75rem;
    }
    
    .palace-info-item {
        padding: 10px 4px;
        min-height: 45px;
    }
    
    .palace-info-item:nth-child(4) {
        grid-column: 1 / 3;
    }
    
    .palace-info-item:nth-child(5) {
        grid-column: 3;
    }
    
    .palace-info-value {
        font-size: 1.1em;
    }
    
    .popup-tabs {
        padding: 0 20px;
    }
    
    .popup-tab {
        padding: 10px 12px;
        font-size: 0.85rem;
        min-width: 80px;
    }
    
    .tab-content {
        padding: 16px 20px;
    }
    
    .sub-tabs {
        margin-bottom: 12px;
        padding: 3px;
    }
    
    .sub-tab {
        padding: 6px 12px;
        font-size: 0.8rem;
        min-width: 60px;
    }
    
    .popup-table {
        display: block;
        overflow: visible;
        white-space: normal;
        table-layout: auto;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    
    .popup-table thead,
    .popup-table tbody,
    .popup-table th,
    .popup-table td,
    .popup-table tr {
        display: block;
    }
    
    .popup-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .popup-table tr {
        border: 1px solid #e9ecef;
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 16px;
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        position: relative;
    }
    
    .popup-table td {
        border: none !important;
        padding: 8px 0 !important;
        position: relative;
        padding-left: 45% !important;
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
        width: auto !important;
        min-height: 28px;
        display: flex;
        align-items: center;
        font-size: 0.85rem !important;
        line-height: 1.4;
    }
    
    .popup-table td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 0;
        width: 40%;
        padding-right: 8px;
        white-space: normal;
        font-weight: 600;
        color: #dc2626;
        background: #fef2f2;
        padding: 6px 8px;
        border-radius: 4px;
        font-size: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        align-items: center;
        line-height: 1.2;
    }
    
    .popup-table td:first-child {
        background: transparent !important;
        color: #374151 !important;
        font-weight: 500 !important;
        width: auto !important;
        min-width: auto !important;
    }
    
    .description-area {
        padding: 16px;
        margin-top: 12px;
        min-height: 80px;
        font-size: 0.9rem;
    }
    
    .section-title {
        font-size: 1rem;
        padding: 10px 12px;
        margin-bottom: 8px;
    }
    
    .two-section-layout {
        gap: 16px;
    }
}

/* Enhanced animations */
.popup-tab,
.sub-tab {
    position: relative;
    overflow: hidden;
}

.popup-tab::before,
.sub-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.popup-tab:hover::before,
.sub-tab:hover::before {
    left: 100%;
}

/* Table animations */
.popup-table tbody tr {
    transition: all 0.2s ease;
}

.popup-table tbody tr:hover {
    transform: translateX(2px);
}

/* Loading animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-content.active {
    animation: fadeIn 0.3s ease;
}

.sub-content.active {
    animation: fadeIn 0.2s ease;
} 