/* --------------------------------------------------
   COLOR SYSTEM (easy dark mode later)
-------------------------------------------------- */

:root {
    --bg-main: #f5f5f5;
    --bg-panel: #ffffff;
    --bg-header: #1f2937;
    --bg-sidebar: #e5e7eb;
    --bg-footer: #1f2937;

    --text-main: #333;
    --text-light: #fff;

    --border-light: #ddd;

    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;

    --accent-red: #dc2626;
    --accent-red-hover: #b91c1c;

    --alert-error-bg: #ffe5e5;
    --alert-error-border: #cc0000;
    --alert-error-text: #990000;

    --alert-success-bg: #e5ffe5;
    --alert-success-border: #009900;
    --alert-success-text: #006600;

    --shadow-soft: 0 2px 6px rgba(0,0,0,0.08);
    --shadow-medium: 0 4px 12px rgba(0,0,0,0.12);

    /* ⭐ Sidebar text visibility (light mode) */
    --sidebar-text: #1f2937;
    --sidebar-link: #374151;
    --sidebar-link-hover: #111827;

    /* ⭐ Active-state highlight (light mode) */
    --sidebar-active-bg: #dbeafe;
    --sidebar-active-border: #93c5fd;
    --sidebar-active-text: #1e3a8a;
}

/* --------------------------------------------------
   GLOBAL LAYOUT
-------------------------------------------------- */

body {
    margin: 0;
    padding: 0;
    font-family: "Inter", Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
}

main {
    display: flex;
    min-height: calc(100vh - 60px);
}

.content {
    padding: 30px;
    width: 100%;
    background: var(--bg-panel);
    box-shadow: var(--shadow-soft);
    margin: 20px;
    border-radius: 8px;
}

/* --------------------------------------------------
   HEADER
-------------------------------------------------- */

header {
    background: var(--bg-header);
    color: var(--text-light);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-medium);
}

header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

/* --------------------------------------------------
   SIDEBAR
-------------------------------------------------- */

aside {
    width: 240px;
    background: var(--bg-sidebar);
    padding: 25px;
    border-right: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    color: var(--sidebar-text);
}

.nav-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* ⭐ Sidebar link styling */
.nav-link {
    width: 100%;
    text-align: left;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s ease;
    color: var(--sidebar-link);
    text-decoration: none;
    display: block;
}

/* ⭐ Hover */
.nav-link:hover {
    background: #f9fafb;
    transform: translateX(3px);
    color: var(--sidebar-link-hover);
}

/* ⭐ Active-state highlight */
.nav-link.active {
    background: var(--sidebar-active-bg);
    border-color: var(--sidebar-active-border);
    color: var(--sidebar-active-text);
    font-weight: 600;
    transform: translateX(3px);
}

/* Danger link */
.nav-link.text-red-600 {
    color: var(--accent-red);
}

/* --------------------------------------------------
   FOOTER
-------------------------------------------------- */

footer {
    background: var(--bg-footer);
    color: var(--text-light);
    text-align: center;
    padding: 12px;
    font-size: 13px;
    box-shadow: var(--shadow-medium);
}

/* --------------------------------------------------
   ALERT BOXES
-------------------------------------------------- */

.alert {
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 25px;
    font-weight: 500;
    box-shadow: var(--shadow-soft);
    animation: fadeIn 0.3s ease;
}

.alert.error {
    background: var(--alert-error-bg);
    border: 1px solid var(--alert-error-border);
    color: var(--alert-error-text);
}

.alert.success {
    background: var(--alert-success-bg);
    border: 1px solid var(--alert-success-border);
    color: var(--alert-success-text);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------
   FORMS
-------------------------------------------------- */

form {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

input[type="text"],
input[type="password"] {
    width: 320px;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 14px;
    transition: border 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--accent-blue);
    outline: none;
}

button {
    background: var(--accent-blue);
    color: var(--text-light);
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s ease, transform 0.15s ease;
}

button:hover {
    background: var(--accent-blue-hover);
    transform: translateY(-2px);
}

button.danger {
    background: var(--accent-red);
}

button.danger:hover {
    background: var(--accent-red-hover);
}

.login-container {
    display: flex;
    justify-content: center; /* horizontal */
    align-items: center; /* vertical */
}
/* --------------------------------------------------
   TABLES
-------------------------------------------------- */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

table th,
table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
}

table th {
    background: #f3f4f6;
    text-align: left;
    font-weight: 600;
}

table tr:hover td {
    background: #f9fafb;
}

/* --------------------------------------------------
   RESPONSIVE
-------------------------------------------------- */

@media (max-width: 900px) {
    main {
        flex-direction: column;
    }

    aside {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }

    .content {
        margin: 10px;
        padding: 20px;
    }
}

/* --------------------------------------------------
   DARK MODE
-------------------------------------------------- */

[data-theme="dark"] {
    --bg-main: #111827;
    --bg-panel: #1f2937;
    --bg-header: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-footer: #0f172a;

    --text-main: #e5e7eb;
    --text-light: #f9fafb;

    --border-light: #374151;

    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;

    --accent-red: #ef4444;
    --accent-red-hover: #dc2626;

    --alert-error-bg: #4b1c1c;
    --alert-error-border: #b91c1c;
    --alert-error-text: #fca5a5;

    --alert-success-bg: #1c4b1c;
    --alert-success-border: #22c55e;
    --alert-success-text: #bbf7d0;

    --shadow-soft: 0 2px 6px rgba(0,0,0,0.4);
    --shadow-medium: 0 4px 12px rgba(0,0,0,0.5);

    /* ⭐ Sidebar text visibility (dark mode) */
    --sidebar-text: #e5e7eb;
    --sidebar-link: #f9fafb;
    --sidebar-link-hover: #ffffff;

    /* ⭐ Active-state highlight (dark mode) */
    --sidebar-active-bg: #334155;
    --sidebar-active-border: #475569;
    --sidebar-active-text: #f1f5f9;
}

/* Smooth theme transitions */
body, header, aside, footer, .content, table, input, button {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* --------------------------------------------------
   DARK MODE TOGGLE SWITCH
-------------------------------------------------- */

.theme-toggle {
    display: flex;
    align-items: center;
    margin-left: 20px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0;
    right: 0; bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-blue);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

