/* Admin Panel Styles v1.6.0 */
.admin-container {
    width: 95%;
    max-width: 1200px;
    margin: 80px auto;
    padding: 20px;
    box-sizing: border-box;
    animation: fadeIn 0.4s ease-out;
}

@media (max-width: 768px) {
    .admin-container {
        margin: 60px auto 20px auto;
        padding: 12px;
        width: 100%;
    }
}

.admin-header {
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.admin-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

@media (max-width: 480px) {
    .admin-header h2 {
        font-size: 1.2rem;
    }
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Module Cards */
.admin-module-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    position: relative;
    transition: transform 0.2s, background-color 0.2s;
}

.admin-module-card.clickable:hover {
    transform: translateY(-4px);
    background: rgba(255,255,255,0.05);
    cursor: pointer;
}

.admin-module-card.disabled {
    opacity: 0.5;
    filter: grayscale(1);
    cursor: default;
}

.module-icon {
    font-size: 2.5rem;
    background: var(--bg-secondary);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.module-info h3 {
    margin: 0 0 5px 0;
    color: var(--text-color);
}

.module-info p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.module-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--accent-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Detail View */
.admin-detail-view {
    animation: slideUp 0.3s ease-out;
}

/* Detail View Header */
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
}

.detail-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-family: var(--font-paper);
    color: var(--text-color);
}

.detail-back-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    flex-shrink: 0; /* Prevent shrinking on mobile */
}

/* Admin Table */
.admin-table-container {
    overflow-x: auto;
    background: var(--bg-panel);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch; /* Smooth scroll for iOS */
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.admin-table th {
    background: rgba(0,0,0,0.1);
    padding: 12px 15px;
    color: var(--text-muted);
    font-weight: 600;
}

.admin-table th.sortable {
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
    position: relative;
    padding-right: 25px;
}

.admin-table th.sortable:hover {
    background: rgba(255,255,255,0.05);
    color: var(--accent-light);
}

.admin-table th.sortable::after {
    content: '↕';
    position: absolute;
    right: 8px;
    opacity: 0.3;
    font-size: 0.7rem;
}

.admin-table th.sort-asc::after {
    content: '▲';
    opacity: 1;
    color: var(--accent-light);
}

.admin-table th.sort-desc::after {
    content: '▼';
    opacity: 1;
    color: var(--accent-light);
}

.admin-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.dark-mode .admin-table th {
    background: rgba(255,255,255,0.05);
}

.reason-cell {
    color: #ef4444; /* Alert red */
    font-weight: 500;
}

.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

/* v1.6.0: User Management & Search */
.header-search {
    flex: 1;
    max-width: 400px;
}

.header-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    border-radius: 20px;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.header-search input:focus {
    border-color: var(--accent-light);
}

.user-edit-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}

@media (min-width: 768px) {
    .user-edit-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* v1.5.62: Desktop 3-column layout for precise card spans */
@media (min-width: 1200px) {
    .user-edit-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.edit-card {
    padding: 25px;
}

.edit-card h4 {
    margin: 0 0 20px 0;
    color: var(--accent-light);
    font-size: 1.1rem;
}

.admin-input-group {
    margin-bottom: 20px;
    flex: 1; /* Allow growing in flex rows */
    min-width: 180px; /* Prevent being too small */
}

@media (max-width: 480px) {
    .admin-input-group {
        min-width: 100%;
        margin-bottom: 15px;
    }
}

.rp-edit-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 5px;
}

.rp-edit-row.divider-top {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.admin-input-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-input-group input, 
.admin-input-group select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
}

.admin-input-group input:focus {
    border-color: var(--accent-light);
    outline: none;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: background 0.2s, transform 0.2s;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.loader-small {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top: 3px solid var(--accent-light);
    border-radius: 50%;
    margin: 20px auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .admin-container {
        margin-top: 60px;
        padding: 15px;
    }
    
    .admin-table {
        font-size: 0.8rem;
    }
    
    .admin-table th, .admin-table td {
        padding: 10px;
    }
}

/* ---------------------------------------------------------
   ADVANCED AUDITING (v1.6.5)
--------------------------------------------------------- */

.admin-container {
   max-width: 1200px; /* Consistently match top definition */
}

.edit-card.full-width {
   grid-column: 1 / -1;
}

.admin-table.compact {
   font-size: 0.85rem;
}

.admin-table.compact th, 
.admin-table.compact td {
   padding: 8px 12px;
}

.admin-table-container.compact {
   max-height: 300px;
   overflow-y: auto;
   border: 1px solid rgba(255, 255, 255, 0.1);
   border-radius: 8px;
}

/* Status Indicators */
.status-pill {
   padding: 2px 8px;
   border-radius: 12px;
   font-size: 0.75rem;
   font-weight: 600;
   text-transform: uppercase;
}

.status-verified { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.status-unverified { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.activity-tag {
   color: #a1a1aa;
   font-size: 0.8rem;
   font-style: italic;
}

.activity-online {
   color: #4ade80;
}

/* ---------------------------------------------------------
   DEEP EDITING (v1.7.0)
--------------------------------------------------------- */

.json-editor {
   font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
   font-size: 0.8rem;
   background: rgba(0, 0, 0, 0.4) !important;
   color: #9cdcfe !important; /* Code blue */
   line-height: 1.4;
   resize: vertical;
   border: 1px solid rgba(255, 255, 255, 0.1);
}

.metrics-grid .admin-input-group {
   margin-bottom: 10px;
}

.metrics-grid label {
   font-size: 0.7rem;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
}

.metrics-grid input {
   padding: 8px;
   font-size: 0.9rem;
}

/* v1.5.62: Report Management Styles */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-delete-all {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-delete-all:hover {
    background: #ef4444;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-delete-report {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
    font-size: 1.1rem;
    padding: 4px;
    line-height: 1;
}

.btn-delete-report:hover {
    opacity: 1;
    transform: scale(1.2);
    color: #ef4444;
}

.dark-mode .btn-delete-all {
    background: rgba(239, 68, 68, 0.15);
}

.admin-flex-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.admin-flex-row > * {
    flex: 1;
    min-width: 250px;
}

@media (min-width: 1200px) {
    .info-general-card {
        grid-column: span 1;
    }
    .rp-stats-card {
        grid-column: span 2;
    }
    .stage-stats-card {
        grid-column: span 2;
    }
}

/* ---------------------------------------------------------
   GLOBAL TABLE RESPONSIVENESS (v1.5.62)
--------------------------------------------------------- */

@media (max-width: 600px) {
    /* Audit Table: Hide less critical info */
    #admin-reports-tbody td:nth-child(3), /* Semilla */
    #admin-reports-tbody td:nth-child(4), /* Nivel */
    #admin-referee-detail thead th:nth-child(3),
    #admin-referee-detail thead th:nth-child(4) {
        display: none;
    }

    /* User List: Hide registration date */
    #admin-users-tbody td:nth-child(3),
    #admin-users-list thead th:nth-child(3) {
        display: none;
    }

    @media (max-width: 480px) {
        /* User List: Hide online activity status on very small mobile */
        #admin-users-tbody td:nth-child(4),
        #admin-users-list thead th:nth-child(4) {
            display: none;
        }
    }

    /* Smaller spacing for compact tables on mobile */
    .admin-table.compact th, 
    .admin-table.compact td {
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .edit-card {
        padding: 15px;
    }

    .admin-module-card {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .module-icon {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
    }

    .header-search {
        width: 100%;
        order: 3; /* Push to bottom on wrap */
    }

    .header-search input {
        width: 100%;
    }
}




