/* ========================
   Design Tokens
======================== */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg: #f5f7fb;
    --card-bg: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --sidebar-bg: #2c3e50;
    --sidebar-hover: #16a085;
    --error-bg: #ffe5e5;
    --error-text: #b30000;
    --success-bg: #e6fffa;
    --success-text: #006d5b;
}

/* ========================
   Base
======================== */
body {
    margin: 0;
    font-family: "Inter", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ========================
   Sidebar
======================== */
.sidebar {
    width: 220px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--card-bg);
    position: fixed;
    top: 0;
    left: 0;
    padding-top: 20px;
    overflow-y: auto;
    transition: width 0.3s ease;
}

.sidebar.collapsed { width: 65px; }

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px 10px;
}

.sidebar-header h2 { font-size: 20px; margin: 0; }

#toggleSidebar {
    background: none;
    border: none;
    color: var(--card-bg);
    font-size: 20px;
    cursor: pointer;
}

.sidebar ul { list-style: none; padding: 0; margin: 0; }

.sidebar ul li a {
    color: var(--card-bg);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 12px 20px;
    transition: background 0.3s;
}

.sidebar ul li a:hover,
.sidebar ul li a.active { background: var(--sidebar-hover); }

.menu-text { margin-left: 10px; }
.sidebar.collapsed .menu-text { display: none; }

.submenu { max-height: 0; overflow: hidden; background: #34495e; transition: max-height 0.3s ease; }
.submenu a { padding-left: 40px; }

.dropdown-btn i.fa-caret-down { margin-left: auto; transition: transform 0.3s ease; }
.active-dropdown i.fa-caret-down { transform: rotate(90deg); }

.logout { color: #e74c3c !important; }

/* ========================
   Layout
======================== */
.content {
    margin-left: 220px;
    padding: 20px;
    transition: margin-left 0.3s ease;
}
.content.collapsed { margin-left: 65px; }

.content-center {
    min-height: calc(100vh - 40px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* ========================
   Cards
======================== */
.card {
    background: var(--card-bg);
    padding: 32px;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
    width: 100%;
    max-width: 720px;
}

.card-sm { max-width: 420px; }
.card-md { max-width: 560px; }
.card-lg { max-width: 900px; }

.card-header {
    padding: 28px 32px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    margin: 0;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}

/* ========================
   Alerts
======================== */
.alert {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-success { background: var(--success-bg); color: var(--success-text); }

/* ========================
   Forms
======================== */
.form-group {
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
}

label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--muted);
}

input,
textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    background: #fff;
}

textarea { resize: vertical; }

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

/* ========================
   Form Layouts
======================== */
.grid-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}
.grid-form .full { grid-column: 1 / -1; }

.aligned-form {
    display: grid;
    grid-template-columns: 180px 1fr;
    column-gap: 24px;
    row-gap: 20px;
    align-items: center;
}
.aligned-form label { text-align: right; margin: 0; font-weight: 500; }
.aligned-form .full,
.aligned-form .actions { grid-column: 2 / -1; }

.vertical-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 32px;
    max-width: 640px;
}
.vertical-form .form-group.full { grid-column: 1 / -1; }

/* ========================
   Buttons
======================== */
.btn-primary,
.btn-save {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 14px 26px;
    font-size: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn-primary:hover,
.btn-save:hover { background: var(--primary-hover); }

.btn-primary:active,
.btn-save:active { transform: scale(0.98); }

/* ========================
   Footer
======================== */
.footer {
    margin-top: 60px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    padding: 24px 0;
}

/* ========================
   Responsive
======================== */
@media (max-width: 900px) { .grid-form { grid-template-columns: 1fr; } }

@media (max-width: 768px) {
    .sidebar { left: -220px; position: absolute; z-index: 1000; }
    .sidebar.collapsed { left: 0; }
    .content { margin-left: 0; }
    .content.collapsed { margin-left: 220px; }
}
