/**
 * Backend Design System - Shared Styles
 * Common styles for all backend pages (login, dashboards, admin, etc.)
 */

/* ===========================
   CSS Custom Properties
   =========================== */
:root {
    /* Colors */
    --color-primary: #3730A3;
    --color-primary-dark: #2A2380;
    --color-primary-light: #EDC8FF;
    
    --color-background: #FFFFFF;
    --color-background-secondary: #F2F2F2;
    --color-background-tertiary: #F9FAFB;
    
    --color-text-primary: #000000;
    --color-text-secondary: #5E5E5E;
    --color-text-tertiary: #6B7280;
    --color-text-muted: #ACACAC;
    
    --color-border: #E5E7EB;
    --color-border-light: #F0F0F0;
    
    --color-success: #10B981;
    --color-success-dark: #059669;
    --color-error: #EF4444;
    --color-error-dark: #DC2626;
    --color-info: #3B82F6;
    
    /* Typography */
    --font-family-primary: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-secondary: 'Helvetica', 'Poppins', sans-serif;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 40px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 30px;
    --radius-full: 50%;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0px 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0px 10px 60px rgba(226, 236, 249, 0.5);
    --shadow-button: 0 4px 12px rgba(55, 48, 163, 0.3);
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* ===========================
   Global Reset
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-primary);
    background: var(--color-background);
    color: var(--color-text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===========================
   Typography
   =========================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-primary);
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-text-primary);
}

h1 { font-size: 32px; font-weight: 900; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }

p {
    font-family: var(--font-family-secondary);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text-secondary);
}

/* ===========================
   Layout Components
   =========================== */
.container-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--spacing-lg);
}

.container-full-background {
    background: var(--color-background-secondary);
    min-height: 100vh;
}

/* ===========================
   Card Components
   =========================== */
.card {
    background: var(--color-background);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition-normal);
}

.card:hover {
    box-shadow: 0px 8px 30px rgba(0, 0, 0, 0.12);
}

.card-sm {
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
}

.card-compact {
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
}

/* Login/Auth Container */
.auth-container {
    background: var(--color-background);
    padding: var(--spacing-xl);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

/* ===========================
   Form Elements
   =========================== */
.form-group {
    margin-bottom: var(--spacing-lg);
    text-align: left;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: var(--spacing-sm);
}

.form-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-family: var(--font-family-primary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-background);
    color: var(--color-text-primary);
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.form-input:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(55, 48, 163, 0.1);
}

.form-input::placeholder,
input::placeholder,
textarea::placeholder {
    color: #999;
}

/* ===========================
   Buttons
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-family-primary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    min-height: 44px;
    gap: var(--spacing-sm);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Primary Button - Purple Gradient */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-button);
    color: white;
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover:not(:disabled) {
    background: #d1d5db;
    transform: translateY(-1px);
}

/* Success Button */
.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: var(--color-success-dark);
}

/* Danger/Error Button */
.btn-danger {
    background: var(--color-error);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--color-error-dark);
}

/* Accent Button - Light Purple */
.btn-accent {
    background: var(--color-primary-light);
    color: var(--color-text-primary);
}

.btn-accent:hover:not(:disabled) {
    background: #E0B8F0;
}

/* Button Sizes */
.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 36px;
}

.btn-lg {
    padding: 18px 32px;
    font-size: 18px;
}

.btn-full {
    width: 100%;
}

/* ===========================
   Alerts & Notifications
   =========================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-lg);
    font-size: 14px;
    font-weight: 500;
}

.alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.alert-info {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #2563eb;
}

.alert-warning {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #d97706;
}

/* ===========================
   Loading States
   =========================== */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: var(--radius-full);
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

.loading-spinner-dark {
    border-color: #e5e7eb;
    border-top-color: transparent;
}

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

/* ===========================
   Utility Classes
   =========================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }

.hidden { display: none !important; }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* ===========================
   Flexbox Utilities
   =========================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

/* ===========================
   Page-Specific Helpers
   =========================== */

/* Login Page Header */
.auth-header {
    margin-bottom: var(--spacing-xl);
}

.auth-title {
    font-size: 32px;
    font-weight: 900;
    color: var(--color-text-primary);
    margin: 0 0 8px 0;
}

.auth-subtitle {
    font-size: 16px;
    color: var(--color-text-tertiary);
    margin: 0;
}

/* Security Note */
.security-note {
    font-size: 13px;
    color: var(--color-text-tertiary);
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
}

/* Code Input for 2FA/verification */
.code-input {
    text-align: center;
    font-size: 24px;
    font-family: 'Courier New', monospace;
    letter-spacing: 8px;
}

/* Error Icon Display */
.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--color-error);
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1.1rem;
    color: var(--color-text-tertiary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    .auth-container {
        padding: var(--spacing-lg);
        max-width: 100%;
    }
    
    .card {
        padding: var(--spacing-lg);
        border-radius: var(--radius-md);
    }
    
    h1, .auth-title, .error-title {
        font-size: 24px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: var(--spacing-md);
    }
    
    h1, .auth-title {
        font-size: 22px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .code-input {
        font-size: 20px;
        letter-spacing: 6px;
    }
}
