/* ===== ROICORP design system ===== */
:root {
    --dark-blue: #2c3e50;
    --light-blue: #3498db;
    --green: #27ae60;
    --orange: #f39c12;
    --red: #e74c3c;
    --teal: #16a085;
    --sidebar-width: 280px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    background: #f4f6f8;
    color: #222;
}
a { color: var(--light-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Animations ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.fade-in-up { animation: fadeInUp .4s ease both; }
.slide-in-left { animation: slideInLeft .4s ease both; }
.slide-in-right { animation: slideInRight .4s ease both; }

.spinner {
    width: 22px; height: 22px;
    border: 3px solid rgba(52,152,219,.25);
    border-top-color: var(--light-blue);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}

/* ===== Layout shell ===== */
.app-shell { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--dark-blue) 0%, var(--light-blue) 100%);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
    z-index: 1000;
    animation: slideInLeft .4s ease both;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 1px;
}
.sidebar-brand .icon { font-size: 26px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }

.nav-item { position: relative; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 20px;
    color: #fff;
    text-decoration: none;
    transition: transform .2s ease, background .2s ease;
    cursor: pointer;
    border-radius: 999px 0 0 999px;
}
.nav-link .nav-icon { width: 20px; text-align: center; }
.nav-link .nav-arrow { margin-left: auto; transition: transform .25s ease; font-size: 12px; }
.nav-link:hover { transform: translateX(5px); text-decoration: none; color: #fff; }
.nav-item.active > .nav-link {
    background: rgba(255,255,255,.22);
    border-radius: 999px 0 0 999px;
    margin-right: -1px;
    font-weight: 600;
}
.nav-item.open > .nav-link .nav-arrow { transform: rotate(180deg); }

.submenu {
    max-height: 0;
    overflow: hidden;
    background: rgba(0,0,0,.18);
    transition: max-height .3s ease;
}
.nav-item.open > .submenu { max-height: 600px; }
.submenu a {
    display: block;
    padding: 10px 20px 10px 54px;
    color: #e7eef5;
    font-size: 14px;
    text-decoration: none;
    transition: transform .2s ease, color .2s ease;
}
.submenu a:hover { transform: translateX(5px); color: #fff; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.18);
}
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-user .name { font-weight: 600; font-size: 14px; }
.sidebar-user .role { font-size: 12px; opacity: .8; }

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 900;
}

/* ===== Main / Topbar ===== */
.main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left .3s ease;
}
.topbar {
    background: #fff;
    height: 70px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    z-index: 500;
    animation: fadeInUp .4s ease both;
}
.hamburger {
    background: none; border: none; cursor: pointer;
    font-size: 22px; color: var(--dark-blue);
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s ease;
}
.hamburger:hover { background: #eef2f6; }
.topbar-titles { flex: 1; }
.topbar-titles h1 { margin: 0; font-size: 18px; color: var(--dark-blue); }
.topbar-titles .subtitle { font-size: 13px; color: #8492a6; }
.topbar-user { position: relative; display: flex; align-items: center; gap: 10px; }
.topbar-user .avatar { background: var(--light-blue); color: #fff; }
.topbar-user .uname { font-size: 14px; color: var(--dark-blue); font-weight: 600; }
.user-dropdown {
    position: absolute; right: 0; top: 52px;
    background: #fff; border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    min-width: 160px; padding: 8px;
    display: none;
    z-index: 600;
}
.user-dropdown.show { display: block; }
.user-dropdown a {
    display: block; padding: 10px 12px; border-radius: 8px;
    color: var(--dark-blue); font-size: 14px;
}
.user-dropdown a:hover { background: #eef2f6; text-decoration: none; }

.container { max-width: 1200px; width: 100%; margin: 0 auto; padding: 24px; }

/* ===== Cards ===== */
.panel {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
    margin-bottom: 24px;
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease;
    animation: fadeInUp .4s ease both;
}
.panel:hover { transform: translateY(-5px); box-shadow: 0 12px 28px rgba(0,0,0,.13); }
.panel-header {
    background: linear-gradient(180deg, #f8fafc, #eef2f6);
    padding: 16px 22px;
    font-weight: 700;
    color: var(--dark-blue);
    border-bottom: 1px solid #e5e9ee;
}
.panel-body { padding: 22px; }

/* ===== KPI cards ===== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-bottom: 24px; }
.kpi-card {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform .25s ease, box-shadow .25s ease;
    animation: fadeInUp .4s ease both;
}
.kpi-card:hover { transform: translateY(-5px); box-shadow: 0 12px 28px rgba(0,0,0,.13); }
.kpi-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 24px;
    flex-shrink: 0;
}
.kpi-card.blue .kpi-icon { background: linear-gradient(135deg, var(--light-blue), #2980b9); }
.kpi-card.green .kpi-icon { background: linear-gradient(135deg, var(--green), #1e8449); }
.kpi-card.orange .kpi-icon { background: linear-gradient(135deg, var(--orange), #d68910); }
.kpi-card.red .kpi-icon { background: linear-gradient(135deg, var(--red), #c0392b); }
.kpi-value { font-size: 26px; font-weight: 800; color: var(--dark-blue); line-height: 1.1; }
.kpi-label { font-size: 13px; color: #8492a6; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    border: none;
    border-radius: 999px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
    background: linear-gradient(135deg, var(--light-blue), #2980b9);
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,.18); text-decoration: none; color: #fff; }
.btn-success { background: linear-gradient(135deg, var(--green), #1e8449); }
.btn-warning { background: linear-gradient(135deg, var(--orange), #d68910); }
.btn-danger  { background: linear-gradient(135deg, var(--red), #c0392b); }
.btn-info    { background: linear-gradient(135deg, var(--teal), #117a65); }
button.btn, button { font-family: inherit; }
button:not(.btn) {
    border: none; border-radius: 999px; padding: 10px 22px; font-size: 14px; font-weight: 600;
    color: #fff; cursor: pointer; background: linear-gradient(135deg, var(--light-blue), #2980b9);
    transition: transform .15s ease, box-shadow .15s ease;
}
button:not(.btn):hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,.18); }
.btn-danger, button.btn-danger { background: linear-gradient(135deg, var(--red), #c0392b); }

/* ===== Forms ===== */
form.box, .login-box {
    background: #fff;
    padding: 26px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
    max-width: 520px;
    animation: fadeInUp .4s ease both;
}
form.box label, .login-box label {
    display: block;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--dark-blue);
}
form.box input, form.box select, form.box textarea,
.login-box input {
    width: 100%;
    padding: 10px 14px;
    margin-top: 6px;
    border: 1px solid #dde3ea;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 400;
    transition: border-color .2s ease, box-shadow .2s ease;
    outline: none;
}
form.box input:focus, form.box select:focus, form.box textarea:focus,
.login-box input:focus {
    border-color: var(--light-blue);
    box-shadow: 0 0 0 4px rgba(52,152,219,.18);
}

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
    margin-bottom: 24px;
}
thead th {
    background: linear-gradient(135deg, var(--dark-blue), var(--light-blue));
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: 12px;
    text-align: left;
    padding: 14px 16px;
}
tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #eef1f4;
    font-size: 14px;
    transition: background .15s ease, transform .15s ease;
}
tbody tr:hover td { background: #eaf4fd; }
tbody tr:hover { transform: scale(1.01); }

/* ===== Login ===== */
.login-page {
    display: flex; align-items: center; justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--dark-blue), var(--light-blue));
}
.login-box h1 { color: var(--dark-blue); margin-top: 0; text-align: center; font-size: 22px; }
.lang-switch { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; font-size: 13px; color: #8492a6; }
.lang-switch a { color: #8492a6; font-weight: 600; padding: 2px 6px; border-radius: 6px; }
.lang-switch a.active { color: var(--light-blue); background: rgba(52,152,219,.12); }
.lang-switch a:hover { text-decoration: none; color: var(--light-blue); }
.error { color: var(--red); font-weight: 600; }

.actions { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.muted { color: #8492a6; font-size: 13px; }

/* ===== Responsive ===== */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .main { margin-left: 0; }
    .topbar-user .uname { display: none; }
}

@media (max-width: 640px) {
    table, thead, tbody, th, td, tr { font-size: 12px; }
    .btn, button:not(.nav-link) { width: 100%; justify-content: center; }
    .actions, .toolbar > .btn, form .btn { width: 100%; }
    .actions { flex-direction: column; }
    form.box, .login-box { max-width: 100%; }
}
