/* Modern CSS with Dark Mode & Glassmorphism */

:root {
    /* Blue-Orange Theme (60% Blue, 30% Orange, 10% White) */
    --primary: #00A8E8;
    /* Cyan Blue - Main brand color */
    --primary-dark: #0077B6;
    /* Darker blue for hover states */
    --secondary: #FF6B35;
    /* Vibrant Orange - Accent color */
    --success: #10b981;
    /* Keep green for success */
    --danger: #ef4444;
    /* Keep red for danger */
    --warning: #f59e0b;
    /* Keep amber for warning */

    --bg-primary: #0a1929;
    /* Deep blue-black background */
    --bg-secondary: #1a2332;
    /* Slightly lighter blue-gray */
    --bg-card: rgba(26, 35, 50, 0.7);
    /* Card background with transparency */

    --text-primary: #f1f5f9;
    /* White text */
    --text-secondary: #cbd5e1;
    /* Light gray text */
    --text-muted: #94a3b8;
    /* Muted gray text */

    --border: rgba(0, 168, 232, 0.2);
    /* Blue-tinted border */
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0a1929 0%, #1a2332 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Glassmorphism Card */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

@media (min-width: 768px) {
    .container {
        padding: 2rem;
    }
}

/* Navbar */
.navbar {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Buttons */
.btn {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-size: 1rem;
    min-height: 48px;
    touch-action: manipulation;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 168, 232, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    min-height: 48px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 168, 232, 0.15);
}

.form-select {
    width: 100%;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    min-height: 48px;
    cursor: pointer;
    -webkit-appearance: none;
}

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Brand Card */
.brand-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.brand-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.4);
}

.brand-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-domain {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.brand-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 0.875rem;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 2rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

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

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

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.flex {
    display: flex;
}

.flex-between {
    justify-content: space-between;
}

.flex-center {
    justify-content: center;
    align-items: center;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.hidden {
    display: none;
}

/* Mobile-First Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .navbar .container {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 0.75rem;
        padding: 1rem;
    }

    .navbar-menu {
        display: contents;
    }

    /* Top Row: Brand (Left) & Logout (Right) */
    .navbar-brand {
        grid-column: 1 / 3;
        /* Takes 2/3 space */
        grid-row: 1;
        font-size: 1.1rem;
        align-self: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 0;
        margin: 0;
        text-align: left;
    }

    .nav-btn-logout {
        grid-column: 3 / 4;
        /* Top Right */
        grid-row: 1;
        padding: 0.4rem !important;
        background: rgba(239, 68, 68, 0.1);
        color: var(--danger);
        border: 1px solid var(--danger);
        font-size: 0.8rem;
        justify-self: end;
        width: 100%;
        max-width: 80px;
    }

    /* Second Row: User Name */
    .nav-user-name {
        grid-column: 1 / -1;
        /* Full width */
        grid-row: 2;
        display: block !important;
        text-align: center;
        font-size: 0.85rem;
        color: var(--text-secondary);
        padding: 0.25rem 0;
        border-bottom: 1px solid var(--border);
        /* Subtle separator */
        margin-bottom: 0.5rem;
    }

    /* Third Row: Main Actions */
    .nav-btn-ref {
        grid-column: 1 / 2;
        grid-row: 3;
    }

    .nav-btn-billing {
        grid-column: 2 / 3;
        grid-row: 3;
    }

    .nav-btn-pass {
        grid-column: 3 / 4;
        grid-row: 3;
    }

    /* Button Styling Updates */
    .navbar .btn {
        width: 100%;
        padding: 0.6rem 0.25rem;
        font-size: 0.8rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hide admin only on mobile */
    .nav-btn-admin,
    #adminLink {
        display: none !important;
    }

    /* General Button Mobile Styling */
    .navbar .btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.7rem;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        min-height: 40px;
        white-space: nowrap;
    }

    .card {
        padding: 1rem;
        border-radius: 12px;
    }

    .brand-card {
        padding: 1rem;
    }

    .brand-card-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .brand-name {
        font-size: 1rem;
    }

    .brand-domain {
        font-size: 0.875rem;
    }

    /* Optimize buttons for mobile */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    /* Dashboard specific mobile optimizations */
    .dashboard-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
        text-align: center;
    }

    .dashboard-header .btn {
        width: 100%;
    }

    .navbar-menu {
        display: grid;
        grid-template-columns: 1fr 1fr;
        /* 2 columns for buttons */
        gap: 0.75rem;
        width: 100%;
        margin-top: 1rem;
    }

    /* Make logout and name span full width */
    .navbar-menu #userName {
        grid-column: 1 / -1;
        text-align: center;
        margin: 0.5rem 0;
    }

    .navbar-menu button[onclick="handleLogout()"] {
        grid-column: 1 / -1;
        background: rgba(239, 68, 68, 0.1);
        color: var(--danger);
        border: 1px solid var(--danger);
    }

    /* Brand cards grid - single column on mobile */
    .brands-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Reduce badge sizes */
    .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Optimize form groups */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-input,
    .form-select {
        font-size: 1rem;
        /* Prevent zoom on iOS */
    }

    /* Button groups - keep stacked but reduce spacing */
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
    }

    /* Optimize modal for mobile */
    .modal .card {
        max-width: 95vw !important;
        margin: 1rem;
    }

    /* Reduce heading sizes */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Container padding */
    .container {
        padding: 1rem;
    }
}

/* Larger touch targets for mobile */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .form-input,
    .form-select {
        min-height: 52px;
    }
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-secondary);
    transition: 0.3s;
    border-radius: 28px;
    border: 2px solid var(--border);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    transition: 0.3s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

input:checked+.toggle-slider:before {
    transform: translateX(24px);
    background-color: white;
}

/* Alert Info with Orange Accent */
.alert-info {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.3);
    color: var(--secondary);
}

/* Badge Secondary (Orange) */
.badge-secondary {
    background: rgba(255, 107, 53, 0.1);
    color: var(--secondary);
}

/* Orange accent button */
.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #ff8c5a);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 107, 53, 0.4);
}

/* Blue glow effect for cards */
.card:hover {
    border-color: rgba(0, 168, 232, 0.4);
    box-shadow: 0 20px 30px rgba(0, 168, 232, 0.2);
}
/* ========================================
   GEO-TARGETING STYLES
   ======================================== */

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    margin: 1rem 0;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
}

.checkbox-grid label:hover {
    background: rgba(0, 168, 232, 0.1);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.checkbox-grid input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.checkbox-grid input[type="checkbox"]:checked + span {
    color: var(--primary);
    font-weight: 500;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    padding: 0.5rem 0;
}

.toggle-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}
