/* Rāśi Tantra - Custom Styles */

/* Color Palette */
:root {
    --forest-sage: #6A994E;
    --soft-mint: #A7C957;
    --ivory-green: #F2F4E3;
    --onyx-black: #2D3142;
    --golden-wheat: #FFD166;

    /* Semantic Colors */
    --primary: #6A994E;
    --secondary: #A7C957;
    --background: #F2F4E3;
    --surface: #FFFFFF;
    --text-primary: #2D3142;
    --text-secondary: #4A5568;
    --accent: #FFD166;
    --success: #6A994E;
    --warning: #FFD166;
    --error: #EF4444;
    --info: #3B82F6;
}

/* Base Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--onyx-black);
    font-weight: 600;
    margin-top: 0;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }

/* Buttons */
/* Scoped to user-context only — prevents bleeding into admin dense views.
   Use .btn-rt-primary for explicit user-facing branding. */
.user-context .btn-primary,
.btn-rt-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    min-height: 44px;
    min-width: 44px;
}

.user-context .btn-primary:hover,
.btn-rt-primary:hover {
    background-color: #5a8341;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(106, 153, 78, 0.3);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--text-primary);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #96b84d;
}

.btn-accent {
    background-color: var(--accent);
    color: var(--text-primary);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-accent:hover {
    background-color: #f5c043;
}

.btn-block {
    width: 100%;
    display: block;
}

/* Social Login Buttons */
.btn-google {
    background-color: #4285F4;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    transition: all 0.3s ease;
}

.btn-google:hover {
    background-color: #357ae8;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.btn-facebook {
    background-color: #1877F2;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    transition: all 0.3s ease;
}

.btn-facebook:hover {
    background-color: #166fe5;
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3);
}

.btn-microsoft {
    background-color: #2F2F2F;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    transition: all 0.3s ease;
}

.btn-microsoft:hover {
    background-color: #1f1f1f;
    box-shadow: 0 4px 12px rgba(47, 47, 47, 0.3);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Scoped to user-context only — prevents bleeding into admin dense views.
   Use .rt-form-control for explicit user-facing branding. */
.user-context .form-control,
.rt-form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: white;
}

.user-context .form-control:focus,
.rt-form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(106, 153, 78, 0.1);
}

/* Authentication Container */
.auth-container {
    max-width: 450px;
    margin: 50px auto;
    padding: 40px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary);
}

.social-login {
    margin-bottom: 30px;
}

.divider {
    text-align: center;
    margin: 30px 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: #e2e8f0;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.divider span {
    background: var(--surface);
    padding: 0 15px;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-links {
    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Dashboard */
.dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding: 30px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.dashboard-header h1 {
    margin: 0;
    color: var(--primary);
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}

.dashboard-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.widget {
    background: var(--surface);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.widget:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.widget h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--primary);
    font-size: 1.25rem;
}

/* Validation */
.text-danger {
    color: var(--error);
    font-size: 14px;
    margin-top: 4px;
}

.checkbox {
    display: flex;
    align-items: center;
}

.checkbox input {
    margin-right: 8px;
    width: 18px;
    height: 18px;
}

/* Mobile-First Responsive Design */
@media (max-width: 640px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .btn,
    .btn-google,
    .btn-facebook,
    .btn-microsoft {
        width: 100%;
        margin-bottom: 12px;
    }

    .auth-container {
        margin: 20px;
        padding: 24px;
    }

    .dashboard-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .auth-links {
        flex-direction: column;
        align-items: center;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .auth-container {
        margin: 40px auto;
    }
}

@media (min-width: 1025px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Navigation */
.navbar {
    background-color: var(--primary);
    padding: 16px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar a {
    text-decoration: none;
    padding: 8px 16px;
    transition: background-color 0.3s ease;
}

.navbar a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Brand Navbar (GAP-U1) — forest-sage background, white text */
.rt-navbar {
    background-color: var(--forest-sage) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.rt-navbar .navbar-brand,
.rt-navbar .nav-link,
.rt-navbar .navbar-text {
    color: white !important;
}

.rt-navbar .nav-link:hover {
    color: var(--soft-mint) !important;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.rt-navbar .navbar-toggler-icon {
    filter: invert(1);
}

/* Brand Card (GAP-U3) */
.rt-card {
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.rt-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* Utilities */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(106, 153, 78, 0.1);
    border-radius: 50%;
    border-top: 3px solid var(--primary);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary,
    .btn-secondary,
    .btn-accent {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Impersonation Banner */
.impersonation-banner {
    position: sticky;
    top: 0;
    z-index: 1100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-bottom: 2px solid #ffc107;
}

.impersonation-banner .btn-dark {
    font-size: 0.875rem;
}

.impersonation-banner strong {
    font-weight: 600;
}

/* ==========================================================================
   Dark Theme Token Preparation (GAP-U7 / Phase 6)
   --rt-* custom properties for Bootstrap 5.3 dark mode support.
   Prerequisite: Phases 1–5 complete.
   Toggle by adding data-bs-theme="dark" to <html> or a container element.
   ========================================================================== */

:root {
    /* Light mode rt-* tokens (mirrors existing palette) */
    --rt-bg:         var(--background);       /* #F2F4E3 */
    --rt-surface:    var(--surface);          /* #FFFFFF */
    --rt-text:       var(--text-primary);     /* #2D3142 */
    --rt-text-muted: var(--text-secondary);   /* #4A5568 */
    --rt-primary:    var(--primary);          /* #6A994E */
    --rt-secondary:  var(--secondary);        /* #A7C957 */
    --rt-accent:     var(--accent);           /* #FFD166 */
    --rt-border:     #e2e8f0;
    --rt-shadow:     rgba(0, 0, 0, 0.08);
    --rt-radius:     12px;
    --rt-radius-sm:  8px;
}

[data-bs-theme='dark'] {
    --rt-bg:         #1a1f2e;
    --rt-surface:    #252b3b;
    --rt-text:       #e8ecef;
    --rt-text-muted: #9aa5b4;
    --rt-primary:    #7ab660;
    --rt-secondary:  #b8d96a;
    --rt-accent:     #ffe082;
    --rt-border:     #3a4258;
    --rt-shadow:     rgba(0, 0, 0, 0.3);

    /* Bootstrap 5.3 dark overrides */
    --bs-body-bg:           var(--rt-bg);
    --bs-body-color:        var(--rt-text);
    --bs-secondary-bg:      var(--rt-surface);
    --bs-tertiary-bg:       #2f3650;
    --bs-border-color:      var(--rt-border);
    --bs-link-color:        var(--rt-primary);
    --bs-link-hover-color:  var(--rt-secondary);
}

/* Theme toggle button */
.rt-theme-toggle {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.rt-theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.7);
}
