:root {
    /* Modern Color Palette */
    --primary: #7b57ff;
    --primary-hover: #9173ff;
    --primary-light: #f3f0ff;
    --success: #00d084;
    --success-light: #e6fdf4;
    --warning: #ffa726;
    --warning-light: #fff8e1;
    --error: #ef5350;
    --error-light: #ffeaea;
    --info: #29b6f6;
    --info-light: #e3f2fd;
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    
    /* Text Colors */
    --text-primary: #1a1a1a;
    --text-secondary: #636363;
    --text-muted: #9e9e9e;
    --text-light: #f1f1f1;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
    
    /* Borders */
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    --border-color: #e5e7eb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #667eea 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    padding: 48px;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
}

.login-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Admin Layout */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.main-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.admin-header {
    background: var(--white);
    padding: 24px 32px;
    border-radius: var(--border-radius-lg);
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--gray-200);
}

.admin-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Modern Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    position: relative;
    padding-bottom: 12px;
}

.card h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

/* Action Card (New - for Admin Dashboard Forms) */
.action-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 24px;
}

.action-card:hover {
    box-shadow: var(--shadow-lg);
}

/* Tab System */
.tab-container {
    position: relative;
}

.tab-header {
    background: var(--gray-50);
    padding: 10px 15px 0 15px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    gap: 5px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 12px 24px;
    border-radius: 8px 8px 0 0;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    position: relative;
}

.tab-btn:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.02);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

.tab-content {
    display: none;
    padding: 24px;
    background: var(--white);
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--white);
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 160px;
    resize: vertical;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    line-height: 1.5;
}

/* Form Grids (New) */
.form-grid-row {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

/* Form Actions Footer (New) */
.form-actions {
    background: var(--gray-50);
    padding: 16px 24px;
    margin: 24px -24px -24px -24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* File Input Styling */
.file-input {
    position: relative;
    background: var(--white);
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.file-input:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.file-input::file-selector-button {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: calc(var(--border-radius) - 2px);
    font-weight: 600;
    cursor: pointer;
    margin-right: 12px;
    transition: background 0.2s ease;
}

.file-input::file-selector-button:hover {
    background: var(--primary-hover);
}

/* Image Preview */
.image-preview {
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 16px;
    background: var(--gray-50);
    text-align: center;
    margin-top: 16px;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: calc(var(--border-radius) - 2px);
    box-shadow: var(--shadow-sm);
    object-fit: contain;
}

.image-info {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Modern Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--white);
    color: var(--text-secondary);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    color: var(--text-primary);
    border-color: var(--gray-400);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #00b96b;
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-warning:hover {
    background: #ff9800;
}

.btn-danger {
    background: var(--error);
    color: var(--white);
}

.btn-danger:hover {
    background: #e53935;
}

.btn-info {
    background: var(--info);
    color: var(--white);
}

.btn-info:hover {
    background: #1e88e5;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid;
}

.alert::before {
    content: '';
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border-left-color: var(--success);
}

.alert-success::before {
    background: var(--success);
}

.alert-error {
    background: var(--error-light);
    color: #991b1b;
    border-left-color: var(--error);
}

.alert-error::before {
    background: var(--error);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table th {
    background: var(--gray-50);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    text-align: left;
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--text-primary);
    vertical-align: middle;
    max-width: 200px;
    word-wrap: break-word;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success {
    background: var(--success-light);
    color: #065f46;
}

.badge-error {
    background: var(--error-light);
    color: #991b1b;
}

/* Code Display */
.code-block {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 20px;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.code-block:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.code-block::after {
    content: 'Click to copy';
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.code-block:hover::after {
    opacity: 1;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Notification System */
.notification-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1100;
    max-width: 420px;
}

.notification {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification.show {
    transform: translateX(0);
}

.notification-success { border-left-color: var(--success); }
.notification-error { border-left-color: var(--error); }
.notification-warning { border-left-color: var(--warning); }
.notification-info { border-left-color: var(--info); }

.notification-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: var(--white);
    flex-shrink: 0;
}

.notification-success .notification-icon { background: var(--success); }
.notification-error .notification-icon { background: var(--error); }
.notification-warning .notification-icon { background: var(--warning); }
.notification-info .notification-icon { background: var(--info); }

.notification-content { flex: 1; }
.notification-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; color: var(--text-primary); }
.notification-message { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

.notification-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination-btn {
    padding: 8px 14px;
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover {
    background: var(--gray-50);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 16px;
    font-weight: 500;
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--white);
    padding: 32px;
    border-radius: var(--border-radius-xl);
    max-width: 520px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.modal-message {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
}

/* Config/Settings Section (New) */
.config-section {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    margin-top: 30px;
    border: 1px solid var(--gray-200);
}

.config-header {
    padding: 15px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    transition: background 0.2s ease;
}

.config-header.closed {
    border-bottom: none;
    border-radius: var(--border-radius-lg);
}

.config-header:hover {
    background: var(--gray-100);
}

.config-toggle-icon {
    width: 24px;
    height: 24px;
    background: var(--gray-200);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 10px;
    transition: transform 0.3s ease;
}

.config-body {
    padding: 24px;
    display: none;
    animation: slideDown 0.3s ease-out;
}

.config-body.open {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-small { font-size: 12px; }
.text-muted { color: var(--text-muted); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

.hidden { display: none; }

/* Responsive Design */
@media (min-width: 768px) {
    .form-grid-row.two-col-heavy-left {
        grid-template-columns: 2fr 1fr;
    }
    .form-grid-row.two-col-balanced {
        grid-template-columns: 1fr 1fr;
    }
    .form-grid-row.three-col {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .admin-container {
        padding: 16px;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        padding: 20px;
    }
    
    .card, .action-card {
        padding: 24px;
        margin-bottom: 20px;
    }
    
    .form-row,
    .form-grid-row,
    .settings-grid {
        grid-template-columns: 1fr !important;
    }
    
    .login-card {
        margin: 16px;
        padding: 32px 24px;
    }
    
    .notification-container {
        left: 16px;
        right: 16px;
        max-width: none;
    }
    
    .modal-content {
        margin: 20px;
        padding: 24px;
        max-width: calc(100% - 40px);
    }
    
    /* Tab responsive design */
    .tab-header {
        flex-direction: column;
        gap: 2px;
    }
    
    .tab-btn {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    /* Hide some table columns on mobile */
    .table th:nth-child(2),
    .table td:nth-child(2),
    .table th:nth-child(3),
    .table td:nth-child(3) {
        display: none;
    }
    
    .table td {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    .table th {
        padding: 12px 8px;
        font-size: 11px;
    }
    
    /* Image preview responsive */
    .image-preview img {
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .admin-title {
        font-size: 24px;
    }
    
    .card h3 {
        font-size: 18px;
    }
    
    .card {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .form-actions button {
        width: 100%;
    }
    
    /* Stack tabs vertically on very small screens */
    .tab-header {
        gap: 8px;
    }
    
    .tab-btn {
        padding: 16px;
        text-align: center;
    }
    
    /* File input responsive */
    .file-input {
        padding: 16px;
        font-size: 13px;
    }
}

/* Enhanced hover effects for interactive elements */
.tab-btn,
.btn,
.form-control,
.code-block {
    transform-style: preserve-3d;
    transform: perspective(1px) translateZ(0);
    backface-visibility: hidden;
}

/* Smooth transitions for better UX */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Focus indicators for accessibility */
.tab-btn:focus,
.btn:focus,
.form-control:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .notification-container,
    .modal-overlay,
    .btn,
    .admin-header {
        display: none !important;
    }
    
    .card, .action-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
    
    body {
        background: white;
    }
}