/* ===============================
   BASE
================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    background: #1e1e1e;
    color: #e5e7eb;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* ===============================
   LAYOUT
================================ */
.layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 240px;
    background: #262626;
    padding: 24px;
    border-right: 1px solid #1a1a1a;
    flex-shrink: 0;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 32px;
    color: #e5e7eb;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar nav a {
    display: block;
    padding: 12px 16px;
    border-radius: 8px;
    color: #9ca3af;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: #1a1a1a;
    color: #e5e7eb;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid #3a3a3a;
    background: #3a3a3a;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.user-info span {
    color: #9ca3af;
}

.user-info a {
    color: #22c55e;
    text-decoration: none;
    transition: color 0.2s;
}

.user-info a:hover {
    color: #16a34a;
}

.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ===============================
   TYPOGRAPHY
================================ */
h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 24px;
    color: #e5e7eb;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 16px;
    color: #e5e7eb;
}

h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px;
    color: #e5e7eb;
}

p {
    margin: 0 0 16px;
    color: #9ca3af;
}

/* ===============================
   FLASH MESSAGES
================================ */
.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flash-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.flash-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #f87171;
}

.flash-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

/* ===============================
   CARDS
================================ */
.card {
    background: #262626;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.card h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

/* ===============================
   FORMS
================================ */
form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    background: #1f1f1f;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    color: #e5e7eb;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    border-color: #22c55e;
    background: #1c1c1c;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
    color: #6b7280;
}

label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #e5e7eb;
    cursor: pointer;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #22c55e;
    cursor: pointer;
}

/* ===============================
   BUTTONS
================================ */
button {
    background: #22c55e;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: #052e16;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background: #16a34a;
}

button:active {
    transform: scale(0.98);
}

button[type="submit"] {
    align-self: flex-start;
}

/* ===============================
   TABLE
================================ */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

table thead {
    background: #1f1f1f;
}

table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #3a3a3a;
}

table td {
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a2a;
    font-size: 14px;
    color: #e5e7eb;
}

table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

table tbody tr:last-child td {
    border-bottom: none;
}

table td form {
    display: inline-block;
    margin: 0 4px 0 0;
}

table td .actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

table td button {
    background: transparent;
    color: #9ca3af;
    padding: 6px 10px;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 6px;
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

table td button:hover {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
}

table td button:active {
    transform: scale(0.95);
}

/* ===============================
   AUTH PAGE
================================ */
body.auth-page {
    background: #1e1e1e;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-container {
    background: #262626;
    width: 400px;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 20px 40px rgba(0, 0, 0, 0.6);
}

.auth-container h1 {
    margin: 0 0 8px;
    font-size: 24px;
}

.auth-container p {
    margin: 0 0 24px;
    color: #9ca3af;
}

.auth-container form {
    margin-top: 0;
}

.auth-container button {
    width: 100%;
    margin-top: 8px;
}

.auth-container .flash {
    margin-top: 16px;
    margin-bottom: 0;
}

.auth-container .remember {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    font-size: 14px;
}

.auth-container .remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #22c55e;
    cursor: pointer;
}

.auth-container .remember span {
    color: #e5e7eb;
    cursor: pointer;
    user-select: none;
}

/* ===============================
   UTILITIES
================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* ===============================
   FILTERS
================================ */
.filters-form {
    margin-top: 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.filter-select,
.filter-input {
    width: 100%;
    padding: 10px 12px;
    background: #1f1f1f;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    color: #e5e7eb;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.filter-select:focus,
.filter-input:focus {
    border-color: #22c55e;
    background: #1c1c1c;
}

.filter-select option {
    background: #1f1f1f;
    color: #e5e7eb;
}

.filters-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filters-actions a {
    padding: 10px 16px;
    background: #3a3a3a;
    color: #e5e7eb;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
}

.filters-actions a:hover {
    background: #4a4a4a;
}

/* ===============================
   MODAL
================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #262626;
    width: 100%;
    max-width: 480px;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 20px 40px rgba(0, 0, 0, 0.8);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin: 0 0 24px;
    font-size: 20px;
    font-weight: 600;
    color: #e5e7eb;
}

.modal-content .form-group {
    margin-bottom: 16px;
}

.modal-content .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #e5e7eb;
    font-weight: 500;
}

.modal-content .form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #9ca3af;
}

.modal-content > label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 14px;
    color: #e5e7eb;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #3a3a3a;
}

.modal-actions button {
    min-width: 100px;
}

.btn-secondary {
    background: #3a3a3a;
    color: #e5e7eb;
}

.btn-secondary:hover {
    background: #4a4a4a;
    color: #e5e7eb;
}
