/**
 * Antigravity Modern Admin Design System
 * Dominant: UBK Crimson / Red Glass & Clean Professional White
 * Cross-Browser Compatible: Chrome, Edge, Firefox, Safari
 */

:root {
    --primary: #c62828;
    --primary-dark: #b71c1c;
    --primary-light: #ef5350;
    --primary-soft: #ffebee;
    --primary-gradient: linear-gradient(135deg, #c62828 0%, #d32f2f 50%, #b71c1c 100%);
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-focus: #c62828;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    --sidebar-width: 270px;
    --header-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   CROSS-BROWSER UNIFIED BUTTON SYSTEM
   ========================================================================== */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:focus,
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.25);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button Variants */
.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff !important;
    border-color: transparent;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #b71c1c 0%, #c62828 100%);
    box-shadow: 0 4px 12px rgba(198, 40, 40, 0.35);
    transform: translateY(-1px);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f1f5f9;
    color: #334155 !important;
    border-color: #e2e8f0;
}
.btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a !important;
}

.btn-danger {
    background: #ef4444;
    color: #ffffff !important;
}
.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    transform: translateY(-1px);
}

.btn-success {
    background: #10b981;
    color: #ffffff !important;
}
.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-warning {
    background: #f59e0b;
    color: #ffffff !important;
}
.btn-warning:hover {
    background: #d97706;
}

.btn-outline {
    background: transparent;
    color: var(--primary) !important;
    border-color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

.btn-pill {
    border-radius: var(--radius-full);
}

/* ==========================================================================
   CONSISTENT PROFESSIONAL FORM INPUTS
   ========================================================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.45rem;
    text-transform: capitalize;
}

.form-group label .required,
label span.required {
    color: #ef4444;
    font-weight: bold;
    margin-left: 2px;
}

.form-group .form-text,
.form-help {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    background-color: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02) inset;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.1em;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input[type="file"] {
    padding: 0.5rem;
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* ==========================================================================
   ADMIN LAYOUT SYSTEM (SIDEBAR + HEADER + MAIN CONTENT + FOOTER)
   ========================================================================== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.25s ease;
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.sidebar-brand h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    line-height: 1.2;
}

.sidebar-brand span {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.menu-category {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 0.6rem 0.85rem 0.3rem;
    letter-spacing: 0.8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    color: #94a3b8;
    transition: color 0.15s ease;
}

.nav-link:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.nav-link:hover i {
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.nav-link.active i {
    color: var(--primary);
}

/* Main Area */
.admin-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.admin-header {
    height: var(--header-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 4px;
}

.header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Language Switcher Pill */
.lang-switcher {
    display: flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.lang-btn {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    color: #64748b;
    border-radius: var(--radius-full);
    transition: all 0.15s ease;
}

.lang-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.2;
}

.user-role {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
}

/* Page Content */
.admin-content {
    flex: 1;
    padding: 1.75rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Consistent Footer */
.admin-footer {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Cards */
.card-box {
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--primary-soft);
    color: var(--primary);
}

.stat-info h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 4px 0;
}

.stat-info .stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
}

/* Security Alert Banner (Requirement 7) */
.security-alert-banner {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1.5px solid #f87171;
    border-left: 6px solid #dc2626;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.alert-content {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.alert-content i {
    font-size: 1.6rem;
    color: #dc2626;
    margin-top: 2px;
}

.alert-text h3 {
    font-size: 0.98rem;
    font-weight: 700;
    color: #991b1b;
    margin: 0 0 3px 0;
}

.alert-text p {
    font-size: 0.85rem;
    color: #7f1d1d;
    margin: 0;
}

/* Flash Messages */
.flash-alert {
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.flash-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.flash-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

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

.admin-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.admin-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: #1e293b;
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: #f8fafc;
}

/* Modal Dialogs (Requirement 15) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.25rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-dialog {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--border-color);
    animation: modalSlideIn 0.2s ease-out;
}

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

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #f8fafc;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Quill Editor Styling - High Visibility & Modern Enterprise Form */
.ql-toolbar.ql-snow {
    border: 1px solid var(--border-color) !important;
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
    background: #f8fafc;
    padding: 8px 12px !important;
}
.ql-container.ql-snow {
    border: 1px solid var(--border-color) !important;
    border-top: none !important;
    border-bottom-left-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    font-family: inherit !important;
    font-size: 0.95rem;
    min-height: 140px;
    background: #ffffff;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}
.ql-container.ql-snow.ql-focus,
.ql-container.ql-snow:focus-within {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}
.ql-editor {
    min-height: 120px !important;
    font-family: inherit !important;
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    color: var(--text-main) !important;
    padding: 12px 14px !important;
}
.ql-editor.ql-blank::before {
    font-style: italic;
    color: #94a3b8;
    left: 14px;
}

/* Responsive */
@media (max-width: 991px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }
    .admin-main {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: inline-block;
    }
}

