/* ===== Variables ===== */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-hover: #334155;
    --sidebar-active: #0d6efd;
    --navbar-height: 64px;
}

/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f8f9fa; }

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    transition: opacity 0.3s;
}

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

.menu-section { margin-bottom: 0.5rem; }

.menu-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: opacity 0.3s, background-color 0.2s;
    cursor: pointer;
    user-select: none;
}

.menu-title:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.menu-title span {
    flex: 1;
}

.menu-chevron {
    font-size: 0.875rem;
    transition: transform 0.3s ease;
    opacity: 0.7;
}

.menu-section.collapsed .menu-chevron {
    transform: rotate(-90deg);
}

.menu-items {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.menu-section.collapsed .menu-items {
    max-height: 0;
    opacity: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.menu-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

.menu-item.active {
    background: var(--sidebar-active);
    color: white;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: white;
}

.menu-item i {
    font-size: 1.25rem;
    width: 24px;
    margin-right: 0.75rem;
    transition: margin 0.3s;
}

.menu-item span { transition: opacity 0.3s; }

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 1rem 0;
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .menu-title span,
.sidebar.collapsed .menu-title .menu-chevron,
.sidebar.collapsed .menu-item span {
    opacity: 0;
    pointer-events: none;
}

.sidebar.collapsed .menu-title {
    pointer-events: none;
}

.sidebar.collapsed .menu-item i {
    margin-right: 0;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

.content-wrapper {
    padding: 2rem;
}

/* ===== Navbar ===== */
.navbar {
    height: var(--navbar-height);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 10px;
}

/* ===== Metric Cards ===== */
.metric-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.metric-content { flex: 1; }

.metric-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.25rem;
}

.metric-change {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.metric-change.positive { color: #198754; }
.metric-change.negative { color: #dc3545; }

/* ===== Cards ===== */
.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-header {
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 1.25rem 1.5rem;
}

/* ===== Activity Feed ===== */
.activity-feed { display: flex; flex-direction: column; gap: 1rem; }

.activity-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.activity-item:last-child { border-bottom: none; padding-bottom: 0; }

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-content { flex: 1; }

.activity-title {
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.25rem;
}

.activity-description {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.75rem;
    color: #adb5bd;
}

/* ===== Traffic Sources ===== */
.source-item {
    padding: 1rem 0;
    border-bottom: 1px solid #e9ecef;
}

.source-item:last-child { border-bottom: none; }

.source-name {
    font-weight: 500;
    color: #212529;
}

.source-value {
    font-weight: 600;
    color: #0d6efd;
}

.sparkline { height: 40px; }

/* ===== Login Page ===== */
.login-page {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow-x: hidden;
}

.login-container {
    height: 100vh;
    overflow-x: hidden;
}

/* ===== reCAPTCHA v3 Badge ===== */
/* Ensure the Google reCAPTCHA badge is always visible on login/register pages */
.grecaptcha-badge {
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 9999 !important;
}

.login-banner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.login-banner::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background-image: var(--login-bg-image);
    background-size: cover;
    background-position: center;
    filter: blur(4px);
    z-index: 0;
}

.login-banner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.7) 0%, rgba(118, 75, 162, 0.7) 100%);
    z-index: 1;
}

.login-banner-content {
    position: relative;
    z-index: 2;
    max-width: 500px;
    padding: 2rem;
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.feature-item {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
}

.login-form-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-form-wrapper {
    width: 100%;
    max-width: 450px;
}

.divider {
    position: relative;
    text-align: center;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #dee2e6;
}

.divider span {
    background: white;
    padding: 0 1rem;
    position: relative;
    color: #6c757d;
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.sidebar-collapsed {
        margin-left: 0;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
}

@media (max-width: 575.98px) {
    .metric-value {
        font-size: 1.5rem;
    }
    
    .navbar {
        height: auto;
        min-height: var(--navbar-height);
    }
}
