/* ===== Custom Properties ===== */
:root {
    --primary: #1e293b;
    --primary-light: #334155;
    --primary-dark: #0f172a;
    --accent: #0d9488;
    --accent-hover: #0f766e;
    --accent-light: #ccfbf1;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --transition: 0.2s ease;
}

/* ===== Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Accent button ===== */
.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
    font-weight: 600;
    transition: all var(--transition);
}

.btn-accent:hover,
.btn-accent:focus {
    background: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ===== Focus styles ===== */
.form-control:focus,
.form-check-input:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.2);
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary);
    color: #fff;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1.25rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand i {
    color: var(--accent);
    font-size: 1.4rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-link.active {
    color: #fff;
    background: var(--accent);
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.75rem 0;
}

.sidebar-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.35);
    padding: 0.25rem 0.85rem;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-user-compact i {
    font-size: 1.2rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

/* ===== Main wrapper (authenticated) ===== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}

/* ===== Top bar ===== */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: var(--shadow-sm);
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

.sidebar-toggle {
    color: var(--text);
    padding: 0.25rem;
    text-decoration: none;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* ===== Content ===== */
.content-area {
    flex: 1;
    padding: 1.75rem 1.5rem;
}

/* ===== Footer ===== */
.main-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===== Cards ===== */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

/* ===== Status badges ===== */
.badge-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35em 0.75em;
    border-radius: 9999px;
    text-transform: capitalize;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-provisioning {
    background: #fef9c3;
    color: #854d0e;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.badge-pending {
    background: #f1f5f9;
    color: #475569;
}

.badge-deleting {
    background: #fce7f3;
    color: #9d174d;
}

/* ===== Public navbar ===== */
.public-navbar {
    background: var(--primary);
    padding: 0.9rem 0;
}

.public-navbar .navbar-brand {
    color: #fff;
    font-size: 1.15rem;
}

.public-navbar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    transition: color var(--transition);
}

.public-navbar .nav-link:hover {
    color: #fff;
}

.public-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.2);
}

.public-navbar .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.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ===== Public footer ===== */
.public-footer {
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

/* ===== Hero section ===== */
.hero-section {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    color: #fff;
    padding: 5rem 0 6rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(13, 148, 136, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.min-vh-75 {
    min-height: 55vh;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
}

.text-accent {
    color: var(--accent);
}

.hero-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 520px;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-graphic {
    font-size: 12rem;
    color: rgba(13, 148, 136, 0.2);
    line-height: 1;
}

/* ===== Features section ===== */
.features-section {
    padding: 5rem 0;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    height: 100%;
    text-align: center;
    transition: all var(--transition);
}

.feature-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--accent);
}

.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    background: var(--accent-light);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
}

/* ===== CTA section ===== */
.cta-section {
    padding: 5rem 0;
    background: var(--bg);
}

/* ===== Auth pages ===== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    border: 1px solid var(--border);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.auth-form .form-floating > label {
    color: var(--text-muted);
}

.auth-form .form-control {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    margin-left: 0.25rem;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ===== Tables ===== */
.table > :not(caption) > * > * {
    padding: 0.85rem 1rem;
}

.table thead th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom-width: 1px;
}

/* ===== Stat cards ===== */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .content-area {
        padding: 1.25rem 1rem;
    }

    .hero-title {
        font-size: 2.25rem;
    }
}

@media (min-width: 992px) {
    .sidebar-toggle {
        display: none !important;
    }
}

@media (max-width: 575.98px) {
    .auth-card {
        padding: 1.75rem 1.25rem;
    }

    .hero-title {
        font-size: 1.85rem;
    }

    .main-footer {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
    }
}

/* ===== Utilities ===== */
.text-accent {
    color: var(--accent) !important;
}

.bg-accent {
    background-color: var(--accent) !important;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-area > * {
    animation: fadeInUp 0.3s ease;
}

/* ===== Loading state on buttons ===== */
.btn[disabled] .btn-text {
    display: none;
}

.btn[disabled] .btn-loading {
    display: inline-flex !important;
    align-items: center;
}

/* ===== Scrollbar ===== */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
