/* Aapla Sunrise — site styles */

:root {
    --az-primary: #ef7f1a;
    --az-primary-dark: #c96a12;
    --az-accent: #ffb155;
    --az-bg: #f4f6f8;
    --az-sidebar-bg: #241f1b;
    --az-sidebar-fg: #e8ddd0;
    --az-sidebar-fg-active: #ffffff;
    --az-card-shadow: 0 2px 6px rgba(0,0,0,.06);
}

body.az-app {
    background: var(--az-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.az-topbar {
    background: var(--az-primary);
    height: 56px;
}

.az-shell {
    display: flex;
    min-height: calc(100vh - 56px);
}

.az-sidebar {
    width: 232px;
    background: var(--az-sidebar-bg);
    color: var(--az-sidebar-fg);
    padding: 16px 0;
    flex-shrink: 0;
}

.az-sidebar .nav-link {
    color: var(--az-sidebar-fg);
    padding: 10px 18px;
    border-left: 3px solid transparent;
    font-size: 14px;
}

.az-sidebar .nav-link i {
    margin-right: 8px;
    width: 18px;
    text-align: center;
}

.az-sidebar .nav-link:hover,
.az-sidebar .nav-link.active {
    background: rgba(255,255,255,0.06);
    color: var(--az-sidebar-fg-active);
    border-left-color: var(--az-accent);
}

.az-sidebar-section {
    margin-top: 16px;
    padding: 4px 18px;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: rgba(207,233,223,.6);
}

/* Collapsible sidebar groups */
.az-sidebar .az-nav-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.az-sidebar .az-nav-caret {
    font-size: 11px;
    transition: transform .15s ease;
}
.az-sidebar .az-nav-group.collapsed .az-nav-caret {
    transform: rotate(-90deg);
}
.az-sidebar .az-submenu {
    background: rgba(0,0,0,.14);
}
.az-sidebar .az-submenu .nav-link {
    padding-left: 42px;
    font-size: 13px;
}

.az-main {
    flex: 1;
    min-width: 0;
}

.az-page-title {
    margin: 0 0 16px;
    font-size: 22px;
    font-weight: 600;
}

.az-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px 18px;
    box-shadow: var(--az-card-shadow);
}

.az-metric {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: var(--az-card-shadow);
    border-left: 4px solid var(--az-primary);
}

.az-metric .label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    margin-bottom: 4px;
}

.az-metric .value {
    font-size: 28px;
    font-weight: 600;
    color: #1a2a2a;
}

.az-metric.accent { border-left-color: var(--az-accent); }
.az-metric.warn   { border-left-color: #f0ad4e; }
.az-metric.danger { border-left-color: #dc3545; }
.az-metric.info   { border-left-color: #0dcaf0; }

/* Auth pages */
.az-auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--az-primary) 0%, var(--az-primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.az-auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 28px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 12px 30px rgba(0,0,0,.18);
}

.az-auth-brand {
    font-size: 24px;
    font-weight: 700;
    color: var(--az-primary);
}

.az-auth-brand i { margin-right: 6px; }

.btn-primary {
    background: var(--az-primary);
    border-color: var(--az-primary);
}
.btn-primary:hover,
.btn-primary:focus {
    background: var(--az-primary-dark);
    border-color: var(--az-primary-dark);
}

/* Re-map Bootstrap's "primary" family (buttons, links, text/bg/border-primary) to the brand orange. */
:root {
    --bs-primary: #ef7f1a;
    --bs-primary-rgb: 239, 127, 26;
    --bs-link-color: #c96a12;
    --bs-link-color-rgb: 201, 106, 18;
    --bs-link-hover-color: #a9560d;
    --bs-link-hover-color-rgb: 169, 86, 13;
}
.btn-primary {
    --bs-btn-bg: var(--az-primary);
    --bs-btn-border-color: var(--az-primary);
    --bs-btn-hover-bg: var(--az-primary-dark);
    --bs-btn-hover-border-color: var(--az-primary-dark);
    --bs-btn-active-bg: var(--az-primary-dark);
    --bs-btn-active-border-color: var(--az-primary-dark);
    --bs-btn-disabled-bg: var(--az-primary);
    --bs-btn-disabled-border-color: var(--az-primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--az-primary);
    --bs-btn-border-color: var(--az-primary);
    --bs-btn-hover-bg: var(--az-primary);
    --bs-btn-hover-border-color: var(--az-primary);
    --bs-btn-active-bg: var(--az-primary);
    --bs-btn-active-border-color: var(--az-primary);
}

/* Contact category groups (form) */
.az-cat-group {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.az-cat-group-header {
    background: var(--az-primary);
    color: #fff;
    padding: 6px 12px;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.az-cat-group-body {
    padding: 8px 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
}

@media (max-width: 576px) {
    .az-cat-group-body { grid-template-columns: 1fr; }
}

.az-cat-group-body .form-check { margin-bottom: 0; }

/* Blocked-contact row highlight */
.az-row-blocked {
    background-color: rgba(220, 53, 69, 0.07) !important;
}
.az-row-blocked a { color: #842029; }

/* Tree view for category admin */
.az-cat-tree { list-style: none; padding-left: 0; margin-bottom: 0; }
.az-cat-tree > li {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f3f5;
}
.az-cat-tree > li:last-child { border-bottom: 0; }
.az-cat-tree ul { list-style: none; padding-left: 24px; margin-top: 6px; }
.az-cat-tree ul li {
    padding: 4px 0;
    color: #495057;
    font-size: 14px;
}
.az-cat-tree .az-cat-name { font-weight: 600; }
.az-cat-tree .az-cat-actions a {
    font-size: 12px;
    margin-left: 8px;
}

/* ============================ Responsive (mobile / tablet) ============================ */

/* Hamburger toggle lives in the topbar; shown only below the lg breakpoint. */
.az-sidebar-toggle { display: none; }
.az-sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .az-sidebar-toggle { display: inline-flex; align-items: center; }

    /* Sidebar slides in as an overlay instead of taking a fixed column. */
    .az-sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        width: 260px;
        max-width: 85vw;
        transform: translateX(-100%);
        transition: transform .2s ease;
        z-index: 1045;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .az-sidebar.az-open {
        transform: translateX(0);
        box-shadow: 4px 0 18px rgba(0,0,0,.35);
    }

    .az-sidebar-backdrop {
        display: block;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,.45);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: opacity .2s ease;
    }
    .az-sidebar-backdrop.az-open { opacity: 1; visibility: visible; }

    /* With the sidebar overlaid, the main content uses the full width. */
    .az-main { width: 100%; }
    .az-page-title { font-size: 20px; }
}

@media (max-width: 575.98px) {
    .az-topbar .navbar-brand { font-size: 1rem; }
    .az-metric .value { font-size: 24px; }
}

/* Keep images and charts from forcing horizontal page scroll. */
.az-main img, .az-main canvas { max-width: 100%; }
