/* ============================================================================
   drs.datameteo.com — base stylesheet
   Layout philosophy mirrors /work/07_sgeu: persistent left sidebar that can
   be collapsed to an icon rail, top bar with brand + flag selector + lang
   selector + user menu.
   ========================================================================= */

:root {
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --topbar-height: 56px;

    /* DRS brand palette */
    --brand:       #d90811;     /* DRS red       */
    --brand-dark:  #9b050b;     /* darker red    */
    --brand-grey:  #565555;     /* DRS dark grey */

    --sidebar-bg:        #3a3a3a;          /* slightly darker than DRS grey for contrast */
    --sidebar-fg:        #e5e5e5;
    --sidebar-fg-muted:  #a8a8a8;
    --sidebar-active:    #262626;
    --content-bg:        #f3f4f6;

    /* Override Bootstrap's primary so .btn-primary, .alert-primary, etc.
       pick up the DRS red without needing per-component CSS. */
    --bs-primary:        #d90811;
    --bs-primary-rgb:    217, 8, 17;
    --bs-link-color:     #d90811;
    --bs-link-hover-color: #9b050b;
    --bs-link-color-rgb: 217, 8, 17;
}

.btn-primary {
    --bs-btn-bg:               var(--brand);
    --bs-btn-border-color:     var(--brand);
    --bs-btn-hover-bg:         var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg:        var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-bg:      var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
}
.btn-secondary {
    --bs-btn-bg:               var(--brand-grey);
    --bs-btn-border-color:     var(--brand-grey);
    --bs-btn-hover-bg:         #444;
    --bs-btn-hover-border-color: #444;
    --bs-btn-active-bg:        #333;
    --bs-btn-active-border-color: #333;
    --bs-btn-disabled-bg:      var(--brand-grey);
    --bs-btn-disabled-border-color: var(--brand-grey);
    --bs-btn-color:            #fff;
    --bs-btn-hover-color:      #fff;
    --bs-btn-active-color:     #fff;
    --bs-btn-disabled-color:   #fff;
}
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: var(--content-bg);
    color: #111827;
}

/* ----- Top bar ----------------------------------------------------------- */
.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 1rem;
    z-index: 1030;
}
.topbar .brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
    color: var(--brand-grey);
    font-weight: 600;
    font-size: 1.05rem;
    margin-right: 1rem;
}
.topbar .brand img {
    height: 32px;
    width: auto;
    display: block;
}
.topbar .sidebar-toggle {
    background: transparent;
    border: 0;
    font-size: 1.25rem;
    color: #374151;
    cursor: pointer;
    padding: .25rem .5rem;
}
.topbar .spacer { flex: 1; }

/* ---- Country flag selector (top-left): rectangular ------------------- */
.country-flags {
    display: flex;
    align-items: center;
    gap: .25rem;
}
.country-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 20px;
    border: 1px solid transparent;
    border-radius: 3px;
    opacity: .55;
    cursor: pointer;
    transition: opacity .12s, border-color .12s;
}
.country-flag:hover { opacity: .85; }
.country-flag.active {
    opacity: 1;
    border-color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand);
}

/* ---- Language selector (top-right): round, prefixed by an icon -------- */
.lang-flags {
    display: flex;
    align-items: center;
    gap: .35rem;
}
.lang-flags .lang-icon {
    color: var(--brand-grey);
    font-size: 1.1rem;
    margin-right: .15rem;
    line-height: 1;
}
.lang-flag {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    padding: 0;
    border: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .15);
    opacity: .55;
    cursor: pointer;
    transition: opacity .12s, box-shadow .12s, transform .12s;
}
.lang-flag:hover { opacity: .85; transform: scale(1.05); }
.lang-flag.active {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--brand);
}
/* The flag-icon-css span uses a ::before pseudo to size itself for the
   default 4x3 aspect ratio. Inside a fixed round container we instead
   stretch the SVG to cover the square. */
.lang-flag .flag-icon {
    display: block;
    width: 100%;
    height: 100%;
    background-size: cover;
}
.lang-flag .flag-icon::before { content: none; }

.usermenu {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    color: #374151;
}
.usermenu .badge-role {
    background: var(--brand-grey);
    color: #fff;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.usermenu a.logout {
    color: var(--brand);
    text-decoration: none;
    font-weight: 500;
}
.usermenu a.logout:hover { text-decoration: underline; }

/* ----- Sidebar ----------------------------------------------------------- */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    overflow-y: auto;
    transition: width .18s ease;
    z-index: 1020;
}
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .sidebar .label { display: none; }
body.sidebar-collapsed .sidebar .section-title { display: none; }

.sidebar .section-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--sidebar-fg-muted);
    padding: 1rem 1rem .35rem 1rem;
}
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem 1rem;
    color: var(--sidebar-fg);
    text-decoration: none;
    font-size: .92rem;
    border-left: 3px solid transparent;
    white-space: nowrap;
}
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .04); color: #fff; }
.sidebar .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--brand);
}
.sidebar .nav-link .bi { font-size: 1.05rem; width: 1.25rem; text-align: center; }
.sidebar .sub { padding-left: 1.75rem; }
.sidebar .sub .nav-link { padding-left: 2.75rem; font-size: .86rem; }

/* ----- Main content area ------------------------------------------------- */
.content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 1.5rem;
    transition: margin-left .18s ease;
}
body.sidebar-collapsed .content { margin-left: var(--sidebar-collapsed); }

.page-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
}

/* ----- Login screen ------------------------------------------------------ */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    padding: 1rem;
}
.login-card {
    background: #fff;
    width: 100%;
    max-width: 380px;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
    text-align: center;
}
.login-card .logo {
    display: block;
    margin: 0 auto 0;
    width: 180px;
    height: auto;
}
.login-card form { text-align: left; }
.login-card .lang-flags {
    justify-content: center;
    margin-bottom: 1rem;
}
.login-card .form-control { margin-bottom: 1rem; }
.login-card .error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: .6rem .8rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: .9rem;
}
