/* Admin Panel Styles (Basic structure) */
.admin-panel {
    display: none; /* Hidden by default */
    /* MODAL OVERLAY STYLES */
    position: fixed; /* Fixed position relative to viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent dark overlay */
    z-index: 1000; /* Ensure it's above other content */
    align-items: flex-start; /* Align content to the top */
    overflow-y: auto; /* Enable scrolling if content exceeds height */

    /* NEW: Grid layout for 3 columns */
    display: grid; /* Use grid for layout */
    grid-template-columns: 250px 1fr 1fr; /* Fixed menu, two flexible content columns */
    grid-template-rows: 100%; /* Take full height */
    gap: 0; /* No gap between grid items, controlled by margins of inner divs */
}

/* Close button for the admin modal */
.admin-panel .close-button {
    position: fixed; /* Fixed position relative to viewport */
    top: 15px;
    right: 25px;
    color: #aaa;
    font-size: 30px; /* Slightly larger */
    font-weight: bold;
    transition: color 0.3s ease;
    z-index: 1002; /* Ensure close button is on top of content area too */
}

.admin-panel .close-button:hover,
.admin-panel .close-button:focus {
    color: #777;
    text-decoration: none;
    cursor: pointer;
}

.admin-menu {
    width: 250px; /* Fixed sidebar width */
    background: linear-gradient(180deg, #ffffff, #f0f4f8); /* Gradient background */
    padding: 20px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.08); /* Softer, more spread shadow */
    flex-shrink: 0; /* Prevent sidebar from shrinking */
    border-right: 1px solid #ddd; /* Separator line */
    /* Adjust height when it's part of a modal */
    min-height: 100%; /* Occupy full height of flex container */
    max-height: 100%; /* Limit height to container */
    overflow-y: auto; /* Scroll if menu is too long */
    grid-column: 1; /* Assign to the first column */
    min-height: 100%; /* Occupy full height of its grid cell */
}

.admin-menu .container {
      padding: 0; /* Remove container padding inside menu */
}

.admin-menu h2 {
    font-size: 1.6em; /* Slightly larger title */
    color: var(--primary-color); /* Use primary color */
    margin-bottom: 30px; /* More space below title */
    text-align: center; /* Center the title */
    font-weight: 700;
}

.admin-menu ul {
    list-style: none;
    padding: 0;
}

.admin-menu li {
    margin-bottom: 15px; /* Increased space between list items */
}

.admin-menu li:last-child {
    margin-bottom: 0; /* No bottom margin for the last item */
}

.admin-menu a {
    display: flex; /* Use flex for icon and text alignment */
    align-items: center;
    padding: 12px 15px; /* More padding */
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px; /* More rounded corners */
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.1s ease;
    font-weight: 500; /* Slightly less bold */
    font-size: 1em;
}

.admin-menu a i {
    margin-right: 10px; /* Space between icon and text */
    font-size: 1.2em; /* Slightly larger icons */
    color: var(--secondary-color); /* Use secondary color for icons */
}

.admin-menu a:hover {
    background-color: #eef4ff; /* Light blue hover background */
    color: var(--primary-color); /* Primary color text on hover */
    transform: translateX(5px); /* Slight slide effect on hover */
}

.admin-menu a:hover i {
      color: var(--primary-color); /* Primary color icon on hover */
}

.admin-menu a.active {
    background-color: var(--primary-color); /* Primary color background for active */
    color: #fff; /* White text for active */
    font-weight: 600; /* Bold text for active */
    box-shadow: 0 2px 8px rgba(106, 17, 203, 0.3); /* Subtle shadow for active item */
}

.admin-menu a.active i {
    color: #fff; /* White icon for active */
}

.admin-main-content, .admin-saved-content {
    background-color: #fff; /* White background for content */
    border-radius: 8px; /* Match sidebar rounding */
    box-shadow: var(--card-shadow); /* Use the standard card shadow */
    overflow-y: auto; /* Enable scrolling within content */
    padding: 30px; /* More padding */
    min-height: calc(100vh - 40px); /* Fill height minus margin */
    margin: 20px 10px; /* Top/bottom margin, horizontal margin reduced for tighter fit */
}

.admin-main-content {
    grid-column: 2; /* Assign to the second column */
    margin-left: 20px; /* Margin from the menu */
    margin-right: 10px; /* Margin towards the third column */
}

.admin-saved-content {
    grid-column: 3; /* Assign to the third column */
    margin-left: 10px; /* Margin from the second column */
    margin-right: 20px; /* Margin from the right edge */
}

.admin-main-content h3 {
    font-size: 2em; /* Larger main title */
    color: var(--primary-color); /* Primary color for main titles */
    margin-bottom: 25px;
    border-bottom: 2px solid var(--accent-color); /* Accent color underline */
    padding-bottom: 10px;
}

.admin-main-content h4 {
      font-size: 1.5em; /* Larger section titles */
      color: var(--secondary-color); /* Secondary color for section titles */
      margin-top: 30px;
      margin-bottom: 20px;
      border-bottom: 1px dashed #eee; /* Dotted separator */
      padding-bottom: 8px;
}

.admin-main-content p {
    margin-bottom: 15px;
    color: #555; /* Softer text color */
}

.admin-main-content ul {
    list-style: disc; /* Use discs for lists */
    padding-left: 20px;
    margin-bottom: 20px;
}

.admin-main-content ul li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.admin-section-block {
      background-color: #f9f9f9; /* Light background for blocks */
      border: 1px solid #eee;
      border-radius: 8px;
      padding: 25px;
      margin-bottom: 30px;
      box-shadow: inset 0 1px 3px rgba(0,0,0,0.05); /* Subtle inner shadow */
}

.admin-section-block h4 {
      margin-top: 0; /* Reset margin-top inside block */
      border-bottom: none; /* Remove dashed border inside block */
      padding-bottom: 0;
      margin-bottom: 15px;
}

/* Specific styles for form groups and buttons within admin content */
.admin-main-content .form-group {
      margin-bottom: 20px;
}

.admin-main-content .form-group label {
      display: block;
      margin-bottom: 8px;
      font-weight: 600;
      color: var(--text-color);
}

.admin-main-content .form-group input[type="text"],
.admin-main-content .form-group input[type="email"],
.admin-main-content .form-group input[type="tel"],
.admin-main-content .form-group input[type="number"],
.admin-main-content .form-group input[type="date"],
.admin-main-content .form-group select,
.admin-main-content .form-group textarea {
      width: 100%;
      padding: 10px;
      border: 1px solid #ccc;
      border-radius: 5px;
      font-size: 1em;
      font-family: 'Poppins', sans-serif;
}

.admin-main-content button.btn {
    padding: 10px 20px;
    font-size: 1em;
}

.admin-main-content .form-message {
    margin-top: 20px;
    padding: 10px;
}

/* Styles for the new third column (admin-saved-content) and its children */
.admin-saved-content h4 {
    font-size: 1.5em;
    color: var(--secondary-color);
    margin-top: 0; /* Reset margin-top for top of column */
    margin-bottom: 20px;
    border-bottom: 1px dashed #eee;
    padding-bottom: 8px;
}
.admin-saved-content p {
    margin-bottom: 15px;
    color: #555;
}
.admin-saved-content ul {
    list-style: disc;
    padding-left: 20px;
    margin-bottom: 20px;
}
.admin-saved-content ul li {
    margin-bottom: 10px;
    line-height: 1.5;
}

/* Specific List Styles for Simulated Data (make sure they work in new column) */
.admin-saved-content ul#simulated-saved-raffles-list,
.admin-saved-content ul#simulated-users-list,
.admin-saved-content #simulated-prizes-list,
.admin-saved-content #simulated-products-list {
      list-style: none; /* Remove default list style */
      padding: 0;
}

.admin-saved-content ul#simulated-saved-raffles-list li,
.admin-saved-content ul#simulated-users-list li {
      background-color: #eef; /* Light background for list items */
      border: 1px solid #dde;
      border-radius: 5px;
      padding: 15px;
      margin-bottom: 10px;
      text-align: left;
      word-break: break-word; /* Prevent overflow on small screens */
}

.admin-saved-content ul li strong {
      color: var(--secondary-color);
}

.admin-saved-content .prize-card-admin,
.admin-saved-content .product-card-admin {
    background-color: #eef;
    border: 1px solid #dde;
    border-radius: 10px;
    box-shadow: none; /* Remove card shadow from parent, use specific list item style */
    padding: 15px;
    margin-bottom: 15px;
    text-align: left;
    display: flex;
    flex-direction: column;
}
.admin-saved-content .prize-card-admin h5 {
    font-size: 1.2em;
    color: var(--primary-color);
    margin-bottom: 10px;
}
.admin-saved-content .prize-card-admin p {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 5px;
}
.admin-saved-content .prize-card-admin .prize-image-preview {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 5px;
    margin-top: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
}

.admin-saved-content .simulated-actions button {
      margin-right: 5px;
      margin-top: 10px;
}

.admin-saved-content #simulated-user-activation-list li {
    background-color: #f8f8f8;
    border: 1px solid #ddd;
}

/* Responsive adjustments */
@media (max-width: 1200px) { /* Tablet landscape and smaller */
    .admin-panel {
        grid-template-columns: 200px 1fr; /* Two columns: menu and stacked main/saved content */
        grid-template-rows: auto; /* Rows adjust to content */
    }

    .admin-menu {
        grid-column: 1;
        grid-row: 1 / span 2; /* Span both rows */
    }

    .admin-main-content {
        grid-column: 2; /* Main content is still second column */
        grid-row: 1; /* First row in its column */
        margin-left: 10px; /* Reduced margin from menu */
        margin-right: 10px; /* Consolidate horizontal margin */
    }

    .admin-saved-content {
        grid-column: 2; /* Saved content is also second column */
        grid-row: 2; /* Second row in its column, effectively stacked */
        margin-top: 0; /* Remove top margin when stacked */
        margin-left: 10px; /* Align with main content */
        margin-right: 10px;
        border-top: 1px dashed #eee; /* Add top border for visual separation when stacked */
    }
}

/* 🚀 SECCIÓN CORREGIDA PARA VISTA EN MÓVILES 🚀 */
@media (max-width: 768px) { /* Mobile portrait and smaller */
    .admin-panel {
        display: flex; /* Cambiamos a flexbox para un control más sencillo */
        flex-direction: column; /* Apila todos los elementos verticalmente */
        position: relative; /* Cambia a posición relativa para que el contenido fluya */
        height: auto; /* Altura automática */
    }
    
    .admin-panel .close-button {
        position: absolute;
        top: 10px;
        right: 10px;
    }
    
    .admin-menu {
        width: 100%; /* El menú ocupa todo el ancho */
        min-height: auto;
        padding: 10px;
        position: relative; /* Asegura que no sea un elemento fijo */
        border-right: none;
        box-shadow: none;
    }

    .admin-menu h2 {
        font-size: 1.4em;
        margin-bottom: 20px;
    }

    .admin-menu ul {
        display: flex;
        flex-direction: row; /* Cambiamos a una fila */
        flex-wrap: wrap; /* Permite que los ítems se envuelvan */
        justify-content: center;
        gap: 8px; /* Espacio entre los ítems */
        list-style: none;
        padding: 0;
    }
    
    .admin-menu li {
        width: auto;
        flex: 1 1 100px; /* Permite que los ítems se ajusten, con un mínimo de 100px */
        margin-bottom: 0;
    }

    .admin-menu a {
        padding: 8px 10px;
        font-size: 0.9em;
        justify-content: center; /* Centra el icono y el texto */
        text-align: center;
        flex-direction: column;
    }
    
    .admin-menu a i {
        margin-right: 0;
        margin-bottom: 5px;
        font-size: 1.1em;
    }

    .admin-main-content,
    .admin-saved-content {
        margin: 10px; /* Margen consistente */
        min-height: auto;
    }

    .admin-saved-content {
        border-top: 1px dashed #eee;
        margin-top: 20px;
    }
    
    .numbers-summary {
        flex-direction: column;
        align-items: center;
    }

    .summary-item {
        margin-bottom: 10px;
    }
    
    .numbers-grid-container {
        max-height: 400px; /* Reducimos la altura en móviles */
    }
}
/* 🚀 FIN DE SECCIÓN CORREGIDA 🚀 */


/* Ensure existing styles for child elements inside admin-main-content apply correctly to new classes */
/* These specific selectors ensure previous styling for .admin-content applies to .admin-main-content as well */
.admin-main-content h3 {
    font-size: 2em;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
}
.admin-main-content h4 {
    font-size: 1.5em;
    margin-top: 30px;
    margin-bottom: 20px;
    border-bottom: 1px dashed #eee;
    padding-bottom: 8px;
}
.admin-main-content p {
    margin-bottom: 15px;
}
.admin-main-content ul {
    list-style: disc;
    padding-left: 20px;
    margin-bottom: 20px;
}
.admin-main-content ul li {
    margin-bottom: 10px;
    line-height: 1.5;
}
.admin-main-content .admin-section-block {
    margin-bottom: 30px;
}
.admin-main-content .admin-section-block h4 {
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 15px;
}
.admin-main-content .form-group {
    margin-bottom: 20px;
}
.admin-main-content .form-group label {
    margin-bottom: 8px;
}
.admin-main-content .form-group input[type="text"],
.admin-main-content .form-group input[type="email"],
.admin-main-content .form-group input[type="tel"],
.admin-main-content .form-group input[type="number"],
.admin-main-content .form-group input[type="date"],
.admin-main-content .form-group select,
.admin-main-content .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
    font-family: 'Poppins', sans-serif;
}
.admin-main-content button.btn {
    padding: 10px 20px;
    font-size: 1em;
}
.admin-main-content .form-message {
    margin-top: 20px;
    padding: 10px;
}

/* Specific list styles within admin-saved-content */
.admin-saved-content #simulated-users-list,
.admin-saved-content #simulated-saved-raffles-list {
    list-style: none; /* Remove default list style */
    padding: 0;
}
.admin-saved-content #simulated-users-list li,
.admin-saved-content #simulated-saved-raffles-list li {
    background-color: #eef;
    border: 1px solid #dde;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 10px;
    text-align: left;
    word-break: break-word;
}

/* New Styles for Numbers Dashboard */
.numbers-dashboard {
    margin-top: 20px;
}

.numbers-summary {
    display: flex;
    justify-content: space-around; /* Distribute space */
    margin-bottom: 20px;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    flex-wrap: wrap; /* Allow wrapping */
    gap: 10px; /* Gap between summary items */
}

.summary-item {
    text-align: center;
    font-size: 1.1em;
    color: #555;
}

.summary-count {
    display: block;
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 5px;
}

.summary-item .status-available { color: #4CAF50; } /* Green */
.summary-item .status-sold { color: #F44336; } /* Red */
.summary-item .status-separated { color: #FFC107; } /* Yellow */

.filter-buttons {
    text-align: center;
    margin-bottom: 20px;
}

.filter-buttons .btn {
    margin: 5px; /* Add margin for spacing */
}

.numbers-grid-container {
    max-height: 600px; /* Max height with scroll */
    overflow-y: auto; /* Enable vertical scrolling */
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background-color: #fff;
}

.numbers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); /* Flexible grid of numbers */
    gap: 8px; /* Gap between number items */
}

.number-item {
    padding: 8px 5px;
    text-align: center;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s ease, opacity 0.3s ease;
    user-select: none; /* Prevent text selection */
      display: flex; /* Use flex for centering text */
      justify-content: center;
      align-items: center;
      word-break: break-all; /* Prevent overflow for long numbers if any */
}

.number-item:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Number Status Colors */
.number-item.status-available {
    background-color: #e8f5e9; /* Light Green */
    color: #2e7d32; /* Dark Green */
    border: 1px solid #a5d6a7;
}

.number-item.status-sold {
    background-color: #ffebee; /* Light Red */
    color: #c62828; /* Dark Red */
      border: 1px solid #ef9a9a;
}

.number-item.status-separated {
    background-color: #fffde7; /* Light Yellow */
    color: #fbc02d; /* Dark Yellow */
    border: 1px solid #fff59d;
}

/* Hidden state for filtering */
.number-item.hidden-by-filter {
    display: none !important; /* Use !important to override grid/flex display */
}

#client-details-display {
      margin-top: 20px;
      padding: 15px;
      border: 1px dashed #90caf9; /* Light blue dashed border */
      background-color: #e3f2fd; /* Light blue background */
      border-radius: 8px;
      text-align: left;
      font-size: 0.95em;
      color: #0c5460;
      display: none; /* Initially hidden */
}

#client-details-display h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #1565c0; /* Dark blue */
      border-bottom: none;
      padding-bottom: 0;
}

#client-details-display p {
      margin-bottom: 8px;
}
#client-details-display p:last-child {
      margin-bottom: 0;
}

#client-details-display strong {
    color: #0c5460; /* Match info box text color */
}