/* ==========================================================================
   Base & Layout
   ========================================================================== */
body {
    font-family: sans-serif;
    background-color: #f3f4f6;
    color: #1f2937;
    margin: 0;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: #1f2937;
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* ==========================================================================
   Sidebar Components
   ========================================================================== */
.sidebar-header {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: bold;
    border-bottom: 1px solid #374151;
    text-align: center;
}
.sidebar-header a { color: white; text-decoration: none; }

.sidebar-menu {
    flex-grow: 1;
    list-style: none;
    padding: 1rem 0;
    margin: 0;
}
.sidebar-menu li a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #d1d5db;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}
.sidebar-menu li a:hover, .sidebar-menu li a.active {
    background-color: #374151;
    color: white;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #374151;
}

/* ==========================================================================
   User Menu (in Sidebar)
   ========================================================================== */
.user-menu-container {
    position: relative;
}
.user-menu-button {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    font-weight: bold;
    color: #d1d5db;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.5rem;
    border-radius: 4px;
}
.user-menu-button:hover {
    background-color: #374151;
    color: white;
}
.user-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    margin-bottom: 0.5rem;
    background-color: #374151;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 10;
}
.user-dropdown.show { display: block; }
.user-dropdown .logout-form { margin: 0; }
.user-dropdown .logout-button {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    color: #fca5a5;
    cursor: pointer;
    font-size: 1rem;
}
.user-dropdown .logout-button:hover {
    background-color: #4b5563;
    color: #ef4444;
}

/* ==========================================================================
   Authentication Pages
   ========================================================================== */
.auth-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding-top: 2rem;
    box-sizing: border-box;
}
.auth-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 600px;
}

/* ==========================================================================
   General Components (Forms, Buttons, Tables, etc.)
   ========================================================================== */
/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: bold; }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Buttons */
.btn { display: inline-block; padding: 0.75rem 1.5rem; background-color: #3b82f6; color: white; text-decoration: none; border: none; border-radius: 4px; cursor: pointer; font-size: 1rem; text-align: center; }
.btn:hover { background-color: #2563eb; }
.btn-primary { background-color: #3b82f6; }
.btn-primary:hover { background-color: #2563eb; }
.btn-success { background-color: #10b981; }
.btn-success:hover { background-color: #059669; }
.btn-danger { background-color: #ef4444; }
.btn-danger:hover { background-color: #dc2626; }
.btn-warning { background-color: #f59e0b; color: black; }
.btn-warning:hover { background-color: #d97706; }
.btn-info { background-color: #0ea5e9; }
.btn-info:hover { background-color: #0284c7; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.875rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; }
th, td { border: 1px solid #d1d5db; padding: 0.25rem; text-align: left; }
th { background-color: #f9fafb; }
td.actions form { display: inline; }
td.actions .btn { margin-right: 0.25rem; }

/* Alerts */
.alert { padding: 1rem; margin-bottom: 1rem; border-radius: 4px; border: 1px solid transparent; }
.alert-success { color: #0f5132; background-color: #d1e7dd; border-color: #badbcc; }
.alert-danger { color: #842029; background-color: #f8d7da; border-color: #f5c2c7; }
.alert-info { color: #0c5460; background-color: #d1ecf1; border-color: #bee5eb; }
.alert ul { margin: 0; padding-left: 1.2rem; }

/* Links */
a { color: #3b82f6; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Modal / Popup */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: #fefefe; margin: 5% auto; padding: 20px; border: 1px solid #888; width: 80%; max-width: 600px; border-radius: 8px; position: relative; }
.close-btn { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close-btn:hover, .close-btn:focus { color: black; text-decoration: none; }
.modal-header { margin-bottom: 1rem; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.5rem; }
.modal-body { max-height: 400px; overflow-y: auto; }
