/**
 * Modern Admin Pages Layout - Multi Column
 * For Agent System & Voucher Online pages
 * Responsive, Dark Mode Compatible
 */

/* ============================================
   CONTAINER & GRID SYSTEM
   ============================================ */

/* Main Container */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Grid 2 Columns */
.grid-2-col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Grid 3 Columns */
.grid-3-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Grid 4 Columns */
.grid-4-col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

/* Grid Auto Fit (dynamic columns) */
.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* ============================================
   STAT CARDS / WIDGETS
   ============================================ */

.stat-card {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.5);
}

.stat-card.blue {
    background: linear-gradient(135deg, #00A8E8 0%, #00D4FF 100%);
    box-shadow: 0 4px 12px rgba(0, 168, 232, 0.3);
}

.stat-card.blue:hover {
    box-shadow: 0 8px 20px rgba(0, 168, 232, 0.5);
}

.stat-card.green {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.stat-card.yellow {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    box-shadow: 0 4px 12px rgba(241, 196, 15, 0.3);
}

.stat-card.red {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Stat Card Content */
.stat-card .stat-icon {
    position: absolute;
    right: 20px;
    bottom: 20px;
    font-size: 48px;
    opacity: 0.2;
}

.stat-card .stat-title {
    font-size: 14px;
    font-weight: 700;
    opacity: 1;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.stat-card .stat-subtitle {
    font-size: 12px;
    opacity: 1;
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   MODERN CARDS
   ============================================ */

.modern-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    margin-bottom: 20px;
}

.modern-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.modern-card-header {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: white;
    padding: 20px;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modern-card-header i {
    margin-right: 10px;
    color: #FFD700;
}

.modern-card-header.blue {
    background: linear-gradient(135deg, #00A8E8 0%, #00D4FF 100%);
}

.modern-card-header.green {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.modern-card-body {
    padding: 25px;
    color: #333;
    line-height: 1.5;
}

.modern-card-body span,
.modern-card-body div:not(.badge-modern) {
    color: inherit;
}

.modern-card-footer {
    background: rgba(0, 0, 0, 0.02);
    padding: 15px 25px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* ============================================
   TABLE ENHANCEMENTS
   ============================================ */

.modern-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.modern-table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.modern-table thead th {
    padding: 15px;
    font-weight: 700;
    color: #495057;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.modern-table tbody td {
    padding: 15px;
    border-bottom: 1px solid #f1f3f5;
    color: #495057;
}

.modern-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(108, 92, 231, 0.05) 0%, rgba(162, 155, 254, 0.02) 100%);
}

.modern-table tbody tr:nth-child(even) {
    background: rgba(248, 249, 250, 0.5);
}

.modern-table tbody tr:nth-child(even):hover {
    background: linear-gradient(90deg, rgba(108, 92, 231, 0.05) 0%, rgba(162, 155, 254, 0.02) 100%);
}

/* ============================================
   FORMS & INPUTS
   ============================================ */

.modern-form-group {
    margin-bottom: 20px;
}

.modern-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.modern-form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.modern-form-input:focus {
    outline: none;
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.modern-form-input::placeholder {
    color: #a0aec0;
    opacity: 1;
}

.modern-form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modern-form-select:focus {
    outline: none;
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-modern {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-modern-primary {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.btn-modern-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(108, 92, 231, 0.5);
}

.btn-modern-success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.btn-modern-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(46, 204, 113, 0.5);
}

.btn-modern-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-modern-warning {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(241, 196, 15, 0.3);
}

.btn-modern-info {
    background: linear-gradient(135deg, #00A8E8 0%, #00D4FF 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 168, 232, 0.3);
}

/* ============================================
   BADGES & LABELS
   ============================================ */

.badge-modern {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-modern-success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}

.badge-modern-warning {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    color: white;
}

.badge-modern-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.badge-modern-info {
    background: linear-gradient(135deg, #00A8E8 0%, #00D4FF 100%);
    color: white;
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    .modern-card {
        background: #343a40;
        color: #e0e0e0;
    }
}

body[class*="dark"] .modern-card,
.dark-theme .modern-card {
    background: #1e272e;
    color: #d1d8e0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body[class*="dark"] .modern-card-body,
.dark-theme .modern-card-body {
    color: #ced6e0;
}

body[class*="dark"] .modern-card-body span,
.dark-theme .modern-card-body span {
    color: #ced6e0;
}

body[class*="dark"] .modern-table,
.dark-theme .modern-table {
    background: #343a40;
    color: #e0e0e0;
}

body[class*="dark"] .modern-table thead,
.dark-theme .modern-table thead {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
}

body[class*="dark"] .modern-table thead th,
.dark-theme .modern-table thead th {
    color: #e0e0e0;
    border-bottom-color: #495057;
}

body[class*="dark"] .modern-table tbody td,
.dark-theme .modern-table tbody td {
    color: #e0e0e0;
    border-bottom-color: #495057;
}

body[class*="dark"] .modern-table tbody tr:nth-child(even),
.dark-theme .modern-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

body[class*="dark"] .modern-form-input,
body[class*="dark"] .modern-form-select,
.dark-theme .modern-form-input,
.dark-theme .modern-form-select {
    background: #2d3436;
    color: #f8f9fa;
    border-color: #495057;
}

body[class*="dark"] .modern-form-input::placeholder,
.dark-theme .modern-form-input::placeholder {
    color: #636e72;
}

body[class*="dark"] .modern-form-label,
.dark-theme .modern-form-label {
    color: #ced6e0;
}

/* Internal card boxes & alerts in Dark Mode */
body[class*="dark"] .modern-card div[style*="background: rgba(0,0,0,0.05)"],
.dark-theme .modern-card div[style*="background: rgba(0,0,0,0.05)"] {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body[class*="dark"] .alert-info[style*="color: #6c5ce7"],
.dark-theme .alert-info[style*="color: #6c5ce7"] {
    color: #a29bfe !important;
    background: rgba(108, 92, 231, 0.15) !important;
}

/* Database Info table in Dash */
body[class*="dark"] .modern-card td[style*="color: #6c757d"],
.dark-theme .modern-card td[style*="color: #6c757d"] {
    color: #a4b0be !important;
}

body[class*="dark"] h5,
.dark-theme h5 {
    color: #fff !important;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet */
@media screen and (max-width: 1024px) {
    .grid-4-col {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3-col {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media screen and (max-width: 768px) {
    .admin-container {
        padding: 10px;
    }

    .grid-2-col,
    .grid-3-col,
    .grid-4-col {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .grid-auto {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card .stat-value {
        font-size: 24px;
    }

    .stat-card .stat-icon {
        font-size: 36px;
    }

    .modern-card-header,
    .modern-card-body,
    .modern-card-footer {
        padding: 15px;
    }

    .modern-table thead th,
    .modern-table tbody td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .btn-modern {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Small Mobile */
@media screen and (max-width: 480px) {
    .stat-card .stat-value {
        font-size: 20px;
    }

    .stat-card .stat-title {
        font-size: 12px;
    }

    .modern-card-header {
        font-size: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .modern-table {
        font-size: 12px;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

.text-left {
    text-align: left !important;
}

.mt-10 {
    margin-top: 10px !important;
}

.mt-20 {
    margin-top: 20px !important;
}

.mb-10 {
    margin-bottom: 10px !important;
}

.mb-20 {
    margin-bottom: 20px !important;
}

.p-10 {
    padding: 10px !important;
}

.p-20 {
    padding: 20px !important;
}

.d-flex {
    display: flex !important;
}

.justify-between {
    justify-content: space-between !important;
}

.align-center {
    align-items: center !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

.gap-10 {
    gap: 10px !important;
}

.gap-20 {
    gap: 20px !important;
}

/* Box Shadow Utilities */
.shadow-sm {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

.shadow-md {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}

.shadow-lg {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16) !important;
}

/* Border Radius */
.rounded-sm {
    border-radius: 4px !important;
}

.rounded {
    border-radius: 8px !important;
}

.rounded-lg {
    border-radius: 12px !important;
}

.rounded-full {
    border-radius: 9999px !important;
}