/* public/css/style.css — Supreme API Word (Twilio Premium Edition) */

/* ============================================================
   CSS VARIABLES - Twilio Inspired
   ============================================================ */
:root {
    /* DEFAULT DARK THEME (Midnight Indigo) */
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --twilio-red: #F22F46;
    --twilio-red-hover: #D91B32;
    
    --bg-body: #020617;
    --bg-sidebar: #0F172A;
    --bg-darker: #0F172A;
    --surface: #1E293B;
    --surface-light: #334155;
    --card-bg: rgba(30, 41, 59, 0.7);
    
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    
    --accent-blue: #38BDF8;
    --border-color: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Bootstrap Overrides for consistent Dark mode row behavior */
    --bs-body-bg: var(--bg-body);
    --bs-body-color: var(--text-primary);
    --bs-tertiary-bg: var(--bg-darker);
    --bs-table-bg: transparent;
}

[data-theme="light"] {
    --bg-body: #F1F5F9;
    --bg-sidebar: #FFFFFF;
    --bg-darker: #F8FAFC;
    --surface: #FFFFFF;
    --surface-light: #F1F5F9;
    --card-bg: rgba(255, 255, 255, 0.9);
    
    --text-primary: #0F172A;
    --text-secondary: #334155;
    --text-muted: #64748B;
    
    --accent-blue: #0284C7;
    --border-color: rgba(0, 0, 0, 0.1);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);

    /* Force Bootstrap to follow our theme */
    --bs-body-bg: var(--bg-body);
    --bs-body-color: var(--text-primary);
    --bs-tertiary-bg: var(--bg-darker);
    --bs-border-color: var(--border-color);
}

/* Light Theme Overrides for Core Utilities */
[data-theme="light"] .text-white, 
[data-theme="light"] .fw-800.text-white { 
    color: var(--text-primary) !important; 
}
[data-theme="light"] .bg-dark { background-color: #F1F5F9 !important; }
[data-theme="light"] .surface-card { background: #FFFFFF !important; }
[data-theme="light"] .table-dark { 
    --bs-table-bg: #F8FAFC !important;
    --bs-table-color: #0F172A !important;
}
[data-theme="light"] .text-muted { color: var(--text-muted) !important; }
[data-theme="light"] .btn-dark { 
    background-color: #E2E8F0 !important; 
    color: #1E293B !important;
    border-color: rgba(0,0,0,0.1) !important;
}

/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: var(--bg-body);
    transition: background-color 0.3s ease, color 0.3s ease;
    background-image: var(--bg-grad, radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%));
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif; /* Switched to Plus Jakarta Sans for a more modern look */
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

[data-theme="light"] body {
    --bg-grad: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%);
}

/* Background Glow Effects */
body::before {
    content: '';
    position: fixed;
    top: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(242, 47, 70, 0.08) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    bottom: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 209, 255, 0.05) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    pointer-events: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-primary);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

p { 
    color: var(--text-secondary); 
    line-height: 1.6; 
    font-size: 15px; 
    font-weight: 450; /* Slightly more than 400 for better clarity on light bg */
}

.small, small { 
    font-size: 13px !important; 
    color: var(--text-muted) !important; 
    font-weight: 600; /* Boosted weight */
}

.text-muted {
    color: var(--text-muted) !important;
}

a { color: var(--twilio-red); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--twilio-red-hover); }

/* ============================================================
   GLASS & SURFACES
   ============================================================ */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.surface-card {
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.surface-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(242, 47, 70, 0.1), transparent);
}

.surface-card:hover {
    border-color: rgba(242, 47, 70, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.6);
}

/* ============================================================
   SIDEBAR & LAYOUT
   ============================================================ */
.sidebar {
    width: 270px;
    height: 100vh;
    position: fixed;
    left: 0; top: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    z-index: 1000;
    transition: var(--transition);
    overflow-x: hidden;
    flex-shrink: 0;
}

.main-content {
    margin-left: 270px;
    padding: 2.5rem;
    min-height: 100vh;
    width: calc(100% - 270px);
    transition: var(--transition);
    position: relative;
}

.nav-link {
    color: var(--text-secondary) !important;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
    transition: var(--transition);
    gap: 12px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary) !important;
}

[data-theme="light"] .nav-link:hover {
    background: rgba(0, 0, 0, 0.05);
}

.nav-link.active {
    background: rgba(242, 47, 70, 0.1);
    color: var(--twilio-red) !important;
}

[data-theme="light"] .nav-link.active {
    background: rgba(242, 47, 70, 0.15); /* Stronger active state */
}

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

/* ============================================================
   BUTTONS - Twilio Style
   ============================================================ */
.btn-primary-custom, .btn-twilio {
    background: var(--twilio-red);
    color: #fff !important;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 4px; /* Twilio uses slightly less rounded boxier buttons */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 13px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-twilio:hover, .btn-primary-custom:hover {
    background: var(--twilio-red-hover);
    box-shadow: 0 4px 15px rgba(242, 47, 70, 0.3);
    transform: translateY(-1px);
}

.btn-secondary-twilio {
    background: transparent;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
    padding: 0.8rem 2rem;
    border-radius: 4px;
    font-weight: 700;
    transition: var(--transition);
}

.btn-secondary-twilio:hover {
    border-color: var(--twilio-red);
    color: var(--twilio-red) !important;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control-custom, .form-control {
    background: var(--surface) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    padding: 0.9rem 1.2rem !important;
    font-size: 14px !important;
}

.form-control-custom:focus, .form-control:focus {
    border-color: var(--primary) !important;
    background: var(--bg-sidebar) !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15) !important;
}

.form-label {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-size: 13px !important;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ============================================================
   NAVBAR & LANDING SPECIFICS
   ============================================================ */
.navbar {
    padding: 1rem 0;
    background: rgba(15, 23, 42, 0.8); /* DEFAULT DARK */
    backdrop-filter: blur(20px);
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.8);
}

.navbar .nav-link {
    color: var(--text-secondary) !important;
    font-size: 14px;
    font-weight: 600;
}

[data-theme="light"] .navbar .nav-link {
    color: var(--text-primary) !important;
}

.navbar .nav-link:hover {
    color: var(--twilio-red) !important;
}

[data-theme="light"] .navbar-brand {
    color: #0F172A !important;
}

/* Navbar Toggler Visibility Fix */
.navbar-toggler {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 4px rgba(242, 47, 70, 0.2);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

[data-theme="light"] .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2815, 23, 42, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

.theme-toggle-btn {
    width: 35px; height: 35px; padding: 0;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    border-color: var(--twilio-red);
    color: var(--twilio-red);
}

/* API KEY BOX / TERMINAL STYLE */
.api-key-box {
    background: #000;
    border-radius: 6px;
    padding: 1rem 1.5rem;
    font-family: 'Fira Code', 'Courier New', monospace;
    color: var(--accent-blue) !important;
    border: 1px solid #1E293B;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================================
   TABLES - High Fidelity Edition
   ============================================================ */
.table { 
    color: var(--text-primary) !important; 
    background-color: transparent !important;
    border-collapse: separate; 
    border-spacing: 0 8px; /* Increased spacing for row separation */
    margin-top: -8px;
}
.table thead th { 
    border: none !important; 
    color: var(--text-muted) !important; 
    text-transform: uppercase; 
    font-size: 10px; 
    letter-spacing: 1.5px; 
    padding: 1.5rem 1rem !important;
    background: transparent !important;
}
.table tbody tr { 
    background: var(--surface) !important; 
    transition: var(--transition);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.table tbody tr:hover { 
    background: var(--surface-light) !important; 
    transform: scale(1.002);
}
[data-theme="light"] .table tbody tr { 
    background: #FFFFFF !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
[data-theme="light"] .table tbody tr:hover {
    background: #F8FAFC !important;
}
.table tbody td { 
    border: none !important; 
    padding: 1.25rem 1rem !important; 
    vertical-align: middle; 
}
.table-responsive {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: slideUp 0.6s ease-out forwards; }

/* ============================================================
   ALERTS / FEEDBACK
   ============================================================ */
.alert {
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

.alert-danger {
    background-color: rgba(242, 47, 70, 0.1) !important;
    border-color: rgba(242, 47, 70, 0.2) !important;
    color: var(--twilio-red) !important;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.2) !important;
    color: #10B981 !important;
}

[data-theme="light"] .alert-danger {
    background-color: #FEF2F2 !important;
    border-color: #F87171 !important;
    color: #991B1B !important;
}

[data-theme="light"] .alert-success {
    background-color: #F0FDF4 !important;
    border-color: #4ADE80 !important;
    color: #166534 !important;
}

/* Fix for forced twilio-red background alerts */
.alert.bg-twilio-red {
    background-color: var(--twilio-red) !important;
    color: #FFFFFF !important;
}

.alert.bg-twilio-red .text-twilio-red {
    color: #FFFFFF !important;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer-area {
    background: #010409;
    position: relative;
    border-top: 1px solid var(--border-color);
    overflow: hidden;
}

.footer-area::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(242, 47, 70, 0.03) 0%, transparent 70%);
    pointer-events: none;
}

.footer-title {
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 2px;
}

.footer-links li a {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.footer-links li a:hover {
    color: var(--twilio-red);
    transform: translateX(5px);
    display: inline-block;
}

.social-link {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary) !important;
    transition: var(--transition);
}

.social-link:hover {
    background: var(--twilio-red);
    color: #fff !important;
    border-color: var(--twilio-red);
    transform: translateY(-3px);
}

.footer-newsletter .form-control-custom {
    background: #0F172A !important;
}

/* UTILS */
.text-twilio-red { color: var(--twilio-red) !important; }
.bg-twilio-red { background: var(--twilio-red) !important; }
/* ============================================================
   TYPOGRAPHY SPECIFICS
   ============================================================ */
.hero-title {
    font-size: 5rem;
    line-height: 1;
    letter-spacing: -0.04em;
    font-weight: 900;
    margin-bottom: 1.5rem;
    background: linear-gradient(to bottom right, #fff 40%, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .hero-title {
    background: linear-gradient(to bottom right, #0F172A 40%, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-red {
    background: linear-gradient(135deg, #F22F46 0%, #FB7185 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.35rem;
    max-width: 580px;
    margin-bottom: 2.5rem;
    color: var(--text-secondary);
}

.section-tag {
    color: var(--twilio-red);
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 800;
    font-size: 11px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-tag::before {
    content: '';
    width: 25px;
    height: 1px;
    background: var(--twilio-red);
}

.navbar-brand {
    font-family: 'Plus Jakarta Sans', sans-serif;
    letter-spacing: -1px;
    font-weight: 800;
}

/* Globally fix low-visibility 8px labels */
.tracking-widest.text-muted {
    font-size: 10px !important;
    letter-spacing: 2px !important;
    font-weight: 800 !important;
}
[data-theme='light'] .tracking-widest.text-muted {
    color: var(--text-primary) !important;
    opacity: 0.8 !important;
}

/* ============================================================
   RESPONSIVE MEDIA QUERIES
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: 100%;
        max-width: 270px;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 1.5rem !important;
        width: 100% !important;
    }
    
    .hero-title {
        font-size: 3rem !important;
        letter-spacing: -1.5px !important;
    }
    
    .hero-desc {
        font-size: 1.1rem !important;
    }

    .navbar-collapse {
        background: var(--surface) !important;
        padding: 1.5rem;
        border-radius: 12px;
        margin-top: 1rem;
        border: 1px solid var(--border-color);
        box-shadow: var(--card-shadow);
        backdrop-filter: blur(20px);
    }
}

@media (max-width: 575.98px) {
    .hero-title {
        font-size: 2.5rem !important;
    }
    
    .login-card, .register-card {
        padding: 2rem !important;
        border-radius: 12px !important;
    }
    
    .section-tag {
        font-size: 10px !important;
    }
    
    .display-4 {
        font-size: 2rem !important;
    }
}

/* ============================================================
   LIGHT THEME OVERRIDES FOR WHITE-ON-WHITE ACCIDENTAL TEXT
   ============================================================ */
[data-theme="light"] .bundle-price,
[data-theme="light"] .stat-mini-num,
[data-theme="light"] .plan-price-tag,
[data-theme="light"] .plan-option-name {
    color: var(--text-primary) !important;
}

[data-theme="light"] .otp-input {
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    color: var(--text-primary) !important;
}


