/* =========================================
   LOTERÍA DEL NIÑO 2026 - THE OBJECTIVE THEME
   Dashboard El Mundo Style - FINAL VERSION
   ========================================= */

/* Base Widget Styles */
.loteria-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 20px 0;
    clear: both;
}

/* =========================================
   EL MUNDO DASHBOARD - HORIZONTAL LAYOUT
   ========================================= */
.loteria-dashboard-elmundo {
    background: #fff;
    border: 1px solid #000;
    border-radius: 8px;
    /* Rounded corners */
    width: 100%;
    max-width: 100%;
    margin: 0 0 30px 0;
    clear: both;
    box-sizing: border-box;
    /* Prevent overflow */
    overflow: hidden;
    display: block;
    /* Enable Container Queries */
    container-type: inline-size;
    container-name: loteria-dashboard;
}

/* Ensure all children use border-box */
.loteria-dashboard-elmundo *,
.loteria-dashboard-elmundo *:before,
.loteria-dashboard-elmundo *:after {
    box-sizing: border-box;
}

/* Header with Black Border */
.loteria-header-dashboard {
    border-bottom: 1px solid #000;
    padding: 12px 20px;
    background: #fff;
}

.loteria-dash-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 900;
    text-transform: uppercase;
    color: #000;
    letter-spacing: 1px;
}

.loteria-dash-content {
    padding: 0;
}

/* =========================================
   GRID LAYOUT - 6 COLUMNS DESKTOP
   ========================================= */
.loteria-dash-grid {
    display: grid;
    /* Optimized Grid: Prizes (Narrower) | Specials (Mid) | Lists (Wider) */
    grid-template-columns: 0.9fr 0.9fr 0.9fr 1.1fr 1.1fr 1.3fr;
    /* Allow shrinking below min-content */
    border-bottom: 1px solid #000;
    width: 100%;
}


.lot-col {
    padding: 15px 8px;
    /* Slightly reduced padding */
    border-right: 1px solid #000;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
    /* Contain inner content */
}

.lot-col:last-child {
    border-right: none;
}

/* Column Headers with Yellow Underline */
/* Column Headers with Yellow Underline */
.lot-label-row {
    position: relative;
    /* STRICT POSITIONING */
    height: 48px;
    /* Fixed height to force alignment */
    margin-bottom: 12px;
    border-bottom: 3px solid #FFE032;
    font-size: 0.7rem;
    font-weight: 900;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lot-label-row.single {
    /* No special centering needed with absolute, just align label top */
}

/* STRICT ALIGNMENT: Label Top-Left, Price Bottom-Right */
.lot-label {
    position: absolute;
    top: 4px;
    /* Align to top (black line) */
    left: 0;
    font-weight: 900;
    line-height: 1.2;
    max-width: 100%;
}

.lot-price {
    position: absolute;
    bottom: 6px;
    /* Align to bottom (red line) */
    right: 0;
    color: #666;
    font-weight: 600;
    font-size: 0.65rem;
    line-height: 1;
}

/* Main Prize Numbers - Large and Bold */
/* Main Prize Numbers - Responsive Scale */
.lot-main-num {
    font-size: clamp(1rem, 2.5vw, 2rem);
    /* Reduced min size to fit narrow cols */
    font-weight: 900;
    text-align: center;
    margin: auto 0;
    letter-spacing: -1px;
    /* Tighter tracking */
    font-family: 'Courier New', Courier, monospace;
    color: #000;
    line-height: 1;
    white-space: nowrap;
    /* FORCE single line */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Specials List (Reintegros) - Fix Text Wrapping */
.lot-specials-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    /* Add spacing */
}

.lot-special-row {
    display: flex;
    flex-direction: row;
    /* Side by side for better density */
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    border-bottom: 1px dotted #ccc;
    padding-bottom: 4px;
    font-size: 0.8rem;
}

/* Force Terminaciones (Last Child) to Stack nicely */
.lot-special-row:last-child {
    flex-direction: column;
    /* Stack Label and Value */
    align-items: center;
    /* Center them */
    border-bottom: none;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    color: #000;
    font-size: 0.75rem;
    word-break: break-word;
    text-align: center;
    /* Center text */
    gap: 0px;
}

/* 2/3 Cifras Grids - Compact */
.lot-grid-2c,
.lot-grid-3c {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
    align-items: flex-start;
}

.lot-grid-2c {
    gap: 1px;
    /* Even tighter for 2 digits */
}

.lot-mini-num {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    font-size: 0.75rem;
    /* Smaller font to fit 5 in row */
    padding: 2px 4px;
    /* Tighter padding */
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 2px;
    color: #000;
    line-height: 1;
}

/* =========================================
   CHECKER SECTION - BOTTOM
   ========================================= */
.loteria-dash-checker {
    padding: 18px 20px;
    background: #fafafa;
    border-top: 1px solid #000;
}

.loteria-form-check-dash {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.lot-input-dash {
    padding: 10px 14px;
    border: 1px solid #999;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 400;
    text-align: center;
    background: #fff;
    color: #000;
    min-width: 130px;
}

.lot-input-dash::placeholder {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 400;
}

.lot-input-dash:focus {
    outline: none;
    border-color: #FFE032;
    box-shadow: 0 0 0 2px rgba(255, 224, 50, 0.2);
}

.lot-input-dash.amt {
    min-width: 70px;
}

.lot-btn-dash {
    background: #FFE032;
    color: #000;
    border: none;
    padding: 10px 22px;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.lot-btn-dash:hover {
    background: #000;
    color: #FFE032;
}

.lot-dash-result {
    margin-top: 12px;
    font-weight: 600;
    text-align: center;
    width: 100%;
    font-size: 0.95rem;
}

/* =========================================
   MOBILE RESPONSIVE - STACKED LAYOUT
   Reduced Heights + Fix Overflow
   ========================================= */
/* =========================================
   RESPONSIVE - STACKED LAYOUT
   Trigger earlier (1024px) for sidebars/narrow cols
   ========================================= */
@media (max-width: 1024px) {
    .loteria-dash-grid {
        display: block;
    }

    .lot-col {
        border-right: none;
        border-bottom: 1px solid #000;
        padding: 15px 18px;
        min-height: auto;
    }

    .lot-col:last-child {
        border-bottom: none;
    }

    .lot-label-row {
        flex-direction: row;
        justify-content: space-between;
        margin-bottom: 10px;
        padding-bottom: 6px;
    }

    .lot-label-row.single {
        justify-content: center;
    }

    .lot-label {
        font-size: 0.85rem;
    }

    .lot-price {
        font-size: 0.8rem;
    }

    .lot-main-num {
        font-size: 2.5rem;
        /* Larger when stacked */
        margin: 15px 0;
        letter-spacing: 2px;
    }

    .loteria-dash-checker {
        padding: 20px 15px;
    }

    .loteria-form-check-dash {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .lot-input-dash,
    .lot-btn-dash {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .lot-input-dash {
        font-size: 1rem;
        padding: 12px;
    }

    .lot-btn-dash {
        font-size: 1rem;
        padding: 14px 20px;
    }
}

/* =========================================
   LEGACY WIDGETS - PREMIOS & EXTRACCIONES
   The Objective Theme
   ========================================= */
.loteria-premios,
.loteria-extracciones {
    background: #fff;
    border: 1px solid #000;
    border-radius: 8px;
    /* Rounded corners */
    overflow: hidden;
    /* Ensure content fits */
    margin: 20px 0;
}

.loteria-premios .loteria-header,
.loteria-extracciones .loteria-header {
    text-align: center;
    padding: 15px 20px;
    border-bottom: 1px solid #000;
    background: #fff;
}

.loteria-premios .loteria-title,
.loteria-extracciones .loteria-title {
    font-size: 1.4rem;
    color: #000;
    margin: 0 0 5px 0;
    font-weight: 900;
    text-transform: uppercase;
}

.loteria-premios .loteria-subtitle {
    color: #666;
    margin: 0;
    font-size: 0.9rem;
}

.loteria-premios .loteria-content,
.loteria-extracciones .loteria-content {
    padding: 20px;
    background: #fff;
}

/* --- Extracciones: Card Group Layout (Audit v2.2.1) --- */
.loteria-extracciones-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.loteria-extraccion-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.loteria-extraccion-card h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #444;
    text-transform: uppercase;
    border-bottom: 2px solid #E30613;
    /* SELAE Red accent */
    display: inline-block;
    padding-bottom: 2px;
}

.prize-info {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    font-style: italic;
    display: block;
    text-align: right;
}

/* Skeleton Auto-Hide Logic (Robust) */
.loteria-extracciones-list:not(:empty)+.lot-extracciones-skeleton {
    display: none !important;
}

.loteria-extracciones-list:not(:empty)~.lot-extracciones-skeleton {
    display: none !important;
}

/* Grid for Numbers */
.loteria-numbers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

/* Badge Style for Numbers */
.badge {
    background: #f5f5f5;
    color: #333;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    font-size: 16px;
    border: 1px solid #ddd;
    letter-spacing: 1px;
}

/* Specific Card Tweaks */
.card-4c .badge {
    font-size: 18px;
    background: #fff8e1;
    /* Light yellow highlight */
    border-color: #ffe082;
}

.card-3c .loteria-numbers-grid {
    /* Dense grid for 14 items */
    gap: 6px;
}

.card-3c .badge {
    font-size: 14px;
}

.card-2c .badge {
    background: #e3f2fd;
    /* Light blue */
    border-color: #90caf9;
}

.card-reintegros .loteria-numbers-grid {
    justify-content: center;
    /* Center reintegros */
}

.card-reintegros .badge {
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    /* Circles for Reintegros */
    background: #E30613;
    color: white;
    border: none;
}

/* Responsive */
@media (max-width: 768px) {
    .ext-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

.loteria-btn-reload {
    display: inline-block;
    background: #FFE032;
    border: none;
    color: #000;
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    text-decoration: none;
}

.loteria-btn-reload:hover {
    background: #000;
    color: #FFE032;
}

/* Footer & Update Info */
.loteria-widget-footer,
.loteria-dash-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.loteria-dash-footer {
    border-top: 1px solid #000;
}

.loteria-update-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
}

.lot-update-label {
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: none;
    color: #666;
    letter-spacing: normal;
}

.lot-last-update {
    font-family: inherit;
    font-weight: 400;
    font-size: 0.8rem;
    color: #666;
}

/* =========================================
   VERTICAL DASHBOARD - ALWAYS STACKED
   ========================================= */
.loteria-dashboard-vertical,
.loteria-dashboard-elmundo.loteria-vertical-mode,
.loteria-premios-horiz.loteria-vertical-mode,
.loteria-vertical-mode {
    background: #fff;
    border: 1px solid #000;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 30px 0;
}

/* Force Column Layout - HIGH SPECIFICITY */
.loteria-dashboard-elmundo.loteria-vertical-mode .loteria-dash-grid,
.loteria-vertical-mode .loteria-dash-grid {
    display: block !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    border-bottom: 1px solid #000;
}

.loteria-dashboard-elmundo.loteria-vertical-mode .lot-col,
.loteria-vertical-mode .lot-col {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border-right: none !important;
    border-bottom: 1px solid #000 !important;
    padding: 20px 25px !important;
    min-height: auto !important;
}

.loteria-dashboard-elmundo.loteria-vertical-mode .lot-col:last-child,
.loteria-vertical-mode .lot-col:last-child {
    border-bottom: none !important;
}

.loteria-dashboard-elmundo.loteria-vertical-mode .lot-main-num,
.loteria-vertical-mode .lot-main-num {
    font-size: 2.2rem !important;
    margin: 15px 0 !important;
    text-align: center !important;
}

.loteria-dashboard-elmundo.loteria-vertical-mode .lot-label-row,
.loteria-vertical-mode .lot-label-row {
    flex-direction: row !important;
    justify-content: space-between !important;
    font-size: 0.8rem !important;
}

.loteria-dashboard-elmundo.loteria-vertical-mode .lot-specials-list,
.loteria-vertical-mode .lot-specials-list {
    font-size: 0.85rem !important;
}

.loteria-dashboard-elmundo.loteria-vertical-mode .lot-grid-2c,
.loteria-dashboard-elmundo.loteria-vertical-mode .lot-grid-3c,
.loteria-vertical-mode .lot-grid-2c,
.loteria-vertical-mode .lot-grid-3c {
    gap: 8px !important;
    justify-content: center !important;
}

/* =========================================
   COMPROBADOR WIDGET STYLING
   ========================================= */
.loteria-comprobador {
    background: #fff;
    border: 2px solid #000;
    border-radius: 8px;
    /* Rounded corners */
    overflow: hidden;
    margin: 0 0 30px 0;
}

.loteria-comprobador .loteria-header {
    background: #fff;
    color: #000;
    padding: 20px;
    position: relative;
    border-bottom: 3px solid #FFE032;
}

.loteria-comprobador .loteria-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 5px 0;
}

.loteria-comprobador .loteria-subtitle {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.9;
}

.loteria-comprobador .loteria-content {
    padding: 30px 20px;
}

.loteria-form-check {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    align-items: end;
    padding-right: 15px;
}

.loteria-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loteria-input-group label {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #333;
}

.loteria-input {
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    transition: all 0.2s;
}

.loteria-input:focus {
    outline: none;
    border-color: #FFE032;
    box-shadow: 0 0 0 3px rgba(255, 224, 50, 0.2);
}

.loteria-btn-check {
    padding: 8px 20px;
    background: #FFE032;
    border: none;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.loteria-btn-check:hover {
    background: #e6c929;
}

.loteria-result {
    margin-top: 20px;
}

.loteria-result-box {
    padding: 20px;
    border-radius: 8px;
    border: 2px solid;
    margin-top: 15px;
}

.loteria-result-win {
    background: #e8f5e9;
    border-color: #4caf50;
}

.loteria-result-lose {
    background: #ffebee;
    border-color: #f44336;
}

.loteria-result-msg {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #000;
}

.loteria-result-amount {
    font-size: 2rem;
    font-weight: 900;
    color: #4caf50;
    margin: 10px 0;
}


/* Responsive Comprobador */
@media (max-width: 768px) {
    .loteria-form-check {
        grid-template-columns: 1fr;
    }

    .loteria-btn-check {
        width: 100%;
    }
}


/* =========================================
   CONTAINER QUERIES (Smart Responsive)
   ========================================= */

/* Compact Mode (e.g. Sidebar Present) < 900px but > Mobile */
@container loteria-dashboard (max-width: 900px) {
    .lot-col {
        padding: 10px 4px !important;
        /* Reduce padding significantly */
    }

    .lot-label-row {
        font-size: 0.6rem !important;
        margin-bottom: 8px !important;
        padding-bottom: 4px !important;
        min-height: 35px !important;
    }

    .lot-price {
        font-size: 0.6rem !important;
    }

    .lot-main-num {
        font-size: clamp(0.9rem, 2vw, 1.4rem) !important;
    }

    .lot-special-row {
        font-size: 0.7rem !important;
        margin-bottom: 4px !important;
    }

    .lot-s-label {
        font-size: 0.65rem !important;
    }

    .lot-grid-2c,
    .lot-grid-3c {
        gap: 2px !important;
    }

    .lot-mini-num {
        padding: 2px 3px !important;
        font-size: 0.7rem !important;
    }
}

/* Mobile Stacked Mode (Very Narrow) < 500px */
/* NOTE: The @media query handles full screen mobile. 
   This handles specific tiny containers (e.g. sidebar widget) */
@container loteria-dashboard (max-width: 480px) {
    .loteria-dash-grid {
        display: block !important;
        grid-template-columns: none !important;
    }

    .lot-col {
        border-right: none !important;
        border-bottom: 1px solid #000 !important;
        padding: 15px !important;
    }

    .lot-col:last-child {
        border-bottom: none !important;
    }

    .lot-label-row {
        flex-direction: row !important;
        justify-content: space-between !important;
        font-size: 0.85rem !important;
    }

    .lot-main-num {
        font-size: 2rem !important;
        margin: 10px 0 !important;
    }

    .lot-grid-2c,
    .lot-grid-3c {
        gap: 5px !important;
    }
}

.wp-block-loteria-vertical {
    margin: 0 !important;
}

.wp-block-loteria-horizontal {
    margin: 0 !important;
}

.loteria-premio-row {
    padding: 15px 18px;
    margin: 12px 0;
    background: #fffef8;
    border: 1px solid #000;
    border-left: 5px solid #FFE032;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.loteria-premio-info strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 3px;
    font-weight: 900;
    color: #000;
}

.loteria-premio-info span {
    color: #666;
    font-size: 0.85rem;
    font-weight: 600;
}

.loteria-premio-num {
    font-size: 1.6em;
    font-weight: 900;
    font-family: 'Courier New', Courier, monospace;
    color: #000;
}

/* Loading States */
.loteria-loading {
    padding: 30px 20px;
    text-align: center;
    color: #666;
    font-size: 0.95rem;
}

/* Result Boxes */
.loteria-result-win {
    background: #e8f5e9;
    border: 2px solid #4CAF50;
    color: #2e7d32;
    padding: 12px;
    border-radius: 4px;
    margin-top: 12px;
    font-weight: 600;
}

.loteria-result-lose {
    background: #ffebee;
    border: 2px solid #f44336;
    color: #c62828;
    padding: 12px;
    border-radius: 4px;
    margin-top: 12px;
    font-weight: 600;
}