/* css/modal.css */

/* =========================================
   1. GLOBAL MODAL SETTINGS
   ========================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* =========================================
   2. MODAL CONTAINER
   ========================================= */
.modal-content {
    background-color: #FFFFFF; 
    border: 3px solid #000;
    border-radius: 20px;
    width: 480px; 
    
    position: absolute;
    top: 50px; 
    left: 50%;
    top: 50%; 
    left: 50%;
    transform: translate(-50%, -50%);
    
    height: auto;        
    max-height: 85vh;
    
    display: flex;        
    flex-direction: column;
    overflow: visible;    
    
    box-shadow: 0 10px 0px rgba(0,0,0,0.3);
}

/* =========================================
   3. HEADER SECTION
   ========================================= */
.modal-header-fixed {
    flex-shrink: 0; 
    background-color: #ebf8fa;
    border-bottom: 2px solid #000000; 
    padding: 15px 10px 10px 10px; 
    border-radius: 16px 16px 0 0; 
    text-align: center;
}

.modal-title-text {
    margin: 0;
    line-height: 1.1;
    letter-spacing: 1px;
    font-family: 'Fredoka One' !important;
    color: #fff !important;         
    text-shadow: none; 
    font-size: 1.5rem;       
    -webkit-text-stroke: 3px #000; 
    paint-order: stroke fill;       
}

.modal-sub-row {
    margin-top: 5px;
    display: flex;
    justify-content: center;
    align-items: center; 
    gap: 8px;
    line-height: 1; 
}

.stat-val-old, .stat-val-new, .val-green, .stat-arrow {
    text-shadow: none;
}

.stat-val-new, .val-green { color: #00ff00 !important; }
.stat-val-old, .stat-arrow { color: #fff; }

.modal-sub-row .stat-val-old, 
.modal-sub-row .stat-val-new,
.modal-sub-row .val-green, 
.modal-sub-row  {
    margin-bottom: 4px; display: flex; align-items: center; 
    font-size: 1rem; color: #ffffff; 
    font-family: 'Fredoka One', sans-serif;
    font-weight: 300;
    -webkit-text-stroke: 2.5px #000000;
    letter-spacing: 0.5px;
    paint-order: stroke fill;
}
/* =========================================
   4. SCROLL AREA
   ========================================= */
.modal-body-scroll {
    flex: 1; 
    overflow-y: auto; 
    padding: 0; 
    background: transparent;
    overflow-x: hidden; 
}

.modal-body-scroll::-webkit-scrollbar {
    display: block;
    width: 6px;
}
.modal-body-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.modal-body-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.modal-body-scroll div {
    box-sizing: border-box;
}

/* =========================================
   5. TABLE STYLING
   ========================================= */
.clean-table {
    width: 100%;
    margin: 0; 
    box-sizing: border-box; 
    table-layout: fixed; 
    border-collapse: separate;
    border-spacing: 0 8px; 
}

/* --- COLUMN 1: LEVEL --- */
.clean-table th:first-child,
.clean-table td:first-child {
    width: 15%;            
    min-width: 50px;
    max-width: 70px;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    position: relative;
    z-index: 1; 
}

.clean-table td:first-child {
    border-left: 1px solid #ececec;
    box-shadow: 2px 0 0 0 #ececec; 
}
/* --- COLUMN 2: VALUE --- */
.clean-table th:last-child,
.clean-table td:last-child {
    width: auto; 
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    border-right: 1px solid #ececec;
}

.clean-table th {
    text-transform: none;
    text-align: center;
    padding: 0 5px;
    letter-spacing: 0.5px;
    color: #000;                    
    -webkit-text-stroke: 0px #000;
    font-size: 0.7rem;      
    font-weight: bold;       
}

.clean-table tbody tr { background-color: transparent; }

/* --- CONSOLIDATED TABLE CELL STYLES --- */
.clean-table td {
    background-color: #ececec;
    padding: 6px 2px; 
    text-align: center;
    border-top: 1px solid #ececec; 
    border-bottom: 1px solid #ececec;
    border-left: none;
    border-right: none;
    
    font-family: 'Fredoka', sans-serif !important; 
    font-size: 1rem;      
    font-weight: 600;   
    
    color: #000000 !important;            
    -webkit-text-stroke: 0px transparent !important; 
    text-shadow: none;

    white-space: nowrap; 
}

.clean-table td div {
    color: #000000 !important;
    font-family: 'Fredoka', sans-serif !important;
    -webkit-text-stroke: 0px transparent !important;
    display: flex; 
    justify-content: center;
    align-items: center;
    font-size: 1rem !important;
    font-weight: 600 !important;
    gap: 4px;
}

/* --- COLORS & ICONS --- */
.val-green { 
    color: #198754 !important; 
    font-family: 'Fredoka', sans-serif !important;
    font-size: 1rem !important;         
    -webkit-text-stroke: 0px transparent !important; 
    font-weight: 600 !important;
}

.stat-arrow-table { 
    display: inline-block; 
    color: #ffffff !important;             
    font-size: 1.0rem; 
    margin: 0; 
    -webkit-text-stroke: 3px #000000 !important; 
    paint-order: stroke fill;
    font-weight: 900 !important;
    vertical-align: middle;
    transform: translateY(-2px); 
}

.icon-gold-inline {
    height: 1.1em;
    width: auto;
    display: block; 
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3));
}

/* =========================================
   SPINE GRID - EXACT CENTER ALIGNMENT
   ========================================= */
.clean-table td .spine-grid {
    display: grid !important;
    grid-template-columns: 1fr 20px 1fr; 
    align-items: center;
    width: 100%;
    gap: 4px;
}

.clean-table td .spine-left {
    display: flex !important;
    justify-content: flex-end !important; 
    align-items: center;
    gap: 4px;
}

.clean-table td .spine-center {
    display: flex !important;
    justify-content: center !important;
    align-items: center;
}

.clean-table td .spine-right {
    display: flex !important;
    justify-content: flex-start !important; 
    align-items: center;
    gap: 4px;
}
/* =========================================
   6. FOOTER & CLOSE BUTTON
   ========================================= */
.modal-footer {
    flex-shrink: 0;
    background-color: #ebf8fa; 
    border-top: 2px solid #000000; 
    border-radius: 0 0 16px 16px; 
    padding: 10px 15px 25px 15px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.modal-disclaimer {
    color: #000000;
    font-size: 0.7rem; 
    letter-spacing: 0.5px;
    margin: 0;
    text-shadow: none;
    -webkit-text-stroke: 0;
    font-weight: 500;
}

.btn-close-floating {
    position: absolute;
    bottom: -24px; 
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 48px;
    background-image: url('../icons/button_close.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    border: none;
    cursor: pointer;
    z-index: 100;
    outline: none;
}
.btn-close-floating span { display: none; }

.btn-info {
    display: inline-block !important;
    width: 20px !important;
    height: 20px !important;
    line-height: 18px !important; 
    text-align: center;
    padding: 0 !important;
    margin-left: 8px;
    background-color: #000;
    color: #fff;
    border: 1.5px solid #000;
    border-radius: 50% !important;
    font-family: 'Fredoka One', sans-serif !important; 
    font-style: normal;
    font-weight: normal;
    font-size: 12px !important;
    cursor: pointer;
    vertical-align: middle;
    transition: transform 0.2s ease, background-color 0.2s ease;
    outline: none;
    -webkit-text-stroke: 0; 
    appearance: none; 
    flex-shrink: 0 !important;
}

.btn-info:hover {
    background-color: #333;
    border-color: #333;
    transform: scale(1.1);
}

/* =========================================
   7. MODAL TABS STYLING (THE 'SETUP/PLAN' LOOK)
   ========================================= */
#modal-tabs-container {
    background-color: #34495e; 
    border: 1.5px solid #000000; 
    border-radius: 12px;
    display: flex;
    align-items: center; 
    width: 95%; 
    max-width: 450px;
    margin: 15px auto; 
    padding: 0;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    height: 32px; 
    box-shadow: none; 
    overflow: visible !important;
    gap: 0; 
}

#modal-tabs-container button, 
#modal-tabs-container .seg-btn {
    flex: 1; 
    height: 100%;
    position: relative; 
    background: transparent;
    border: none;
    border-right: 1.5px solid #000000; 
    margin: 0;
    color: #ffffff;
    font-family: 'Fredoka One', 'Fredoka', sans-serif;
    font-size: 0.9rem; 
    letter-spacing: 0.5px;
    cursor: pointer;
    -webkit-text-stroke: 2px #000000; 
    paint-order: stroke fill;
    text-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1; 
    transition: transform 0.1s ease;
    border-radius: 0; 
}

#modal-tabs-container button:first-child, 
#modal-tabs-container .seg-btn:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

#modal-tabs-container button:last-child, 
#modal-tabs-container .seg-btn:last-child {
    border-right: none; 
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

#modal-tabs-container button.active,
#modal-tabs-container .seg-btn.active {
    z-index: 50 !important; 
    border-right-color: transparent; 
    color: #ffffff;
    font-size: 1.05rem; 
    overflow: visible;
    border-radius: 10px; 
}

#modal-tabs-container button.active::before,
#modal-tabs-container .seg-btn.active::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 106%;  
    height: 120%; 
    background: #00b0ff;
    border: 2px solid #000000;
    border-radius: 10px;
    box-shadow: inset 0 -6px 0 0 #005680; /* Removed outer drop shadow */
    z-index: -1; 
}

/* =========================================
   8. MOBILE ADJUSTMENTS
   ========================================= */
@media (max-width: 768px) {
    .modal-content {
        top: 50% !important; 
        transform: translate(-50%, -50%) !important; 
        width: 95% !important; 
        max-height: 80vh !important; 
        height: auto !important;
    }

    #modal-tabs-container {
        height: 38px !important; 
        min-height: 0 !important;
        padding: 0 !important;
        display: flex;
        overflow-x: visible; 
        overflow-y: visible;
        justify-content: center;
        flex-wrap: nowrap; 
        gap: 0 !important; 
        border-radius: 10px; 
    }
    
    #modal-tabs-container button,
    #modal-tabs-container .seg-btn {
        flex: 1; 
        width: auto;
        min-width: auto;
        padding: 0 !important; 
        min-height: 38px !important; 
        margin: 0 !important;   
        z-index: 1;                  
        font-size: 0.7em; 
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 0; 
    }

    #modal-tabs-container button:first-child,
    #modal-tabs-container .seg-btn:first-child {
        border-top-left-radius: 8px;
        border-bottom-left-radius: 8px;
    }

    #modal-tabs-container button:last-child,
    #modal-tabs-container .seg-btn:last-child {
        border-top-right-radius: 8px;
        border-bottom-right-radius: 8px;
    }

    #modal-tabs-container button.active,
    #modal-tabs-container .seg-btn.active {
        z-index: 100 !important;
        border-radius: 8px !important;
    }
    .clean-table td {
        font-size: 0.85rem !important;
    }
    .clean-table td div {
        font-size: 0.85rem !important;
    }
    .val-green {
        font-size: 0.85rem !important;
    }
    .stat-arrow-table {
        font-size: 0.9rem !important; 
    }
}

.modal-content.confirm-mode {
    width: 280px !important;
    padding: 20px 15px 15px 15px !important;
    border-radius: 16px !important;
}