/* ========================================
   GLOBALE STYLES
   ======================================== */

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

:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --primary-lighter: #475569;
    --accent: #059669;
    --accent-light: #10b981;
    --danger: #dc2626;
    --warning: #f59e0b;
    --success: #10b981;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    --bg-light: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ========================================
   LOGIN PAGE
   ======================================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--primary);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.form-group input:disabled {
    background: var(--bg-light);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn {
    width: 100%;
    padding: 11px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-light);
}

.btn-primary:disabled {
    background: var(--primary-lighter);
    cursor: not-allowed;
    opacity: 0.6;
}

.error-message {
    background: #fee2e2;
    color: var(--danger);
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 20px;
    border-left: 4px solid var(--danger);
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   DASHBOARD LAYOUT
   ======================================== */

.dashboard-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.dashboard-sidebar {
    background: var(--primary);
    color: white;
    padding: 20px;
    box-shadow: var(--shadow);
}

.sidebar-header {
    margin-bottom: 30px;
}

.sidebar-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
}

.sidebar-header .user-role {
    font-size: 12px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 10px;
}

.sidebar-nav a {
    display: block;
    padding: 10px 14px;
    border-radius: 6px;
    color: white;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
}

.sidebar-nav a:hover {
    background: var(--primary-lighter);
}

.sidebar-nav a.active {
    background: var(--accent);
    font-weight: 600;
}

.sidebar-footer {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

.dashboard-main {
    padding: 30px;
    overflow-y: auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.dashboard-header h1 {
    font-size: 28px;
    color: var(--primary);
}

.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

/* ========================================
   TOOLS GRID
   ======================================== */

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.tool-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: inherit;
}

.tool-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-5px);
    border-color: var(--accent);
}

.tool-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.tool-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary);
}

.tool-description {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========================================
   ADMIN PANEL - USERS TABLE
   ======================================== */

.admin-section {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 30px;
}

.admin-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--primary);
}

.admin-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-sm.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-sm.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--bg-light);
    border-bottom: 2px solid var(--border);
}

.table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.table tbody tr:hover {
    background: var(--bg-light);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-admin {
    background: #dbeafe;
    color: #0c4a6e;
}

/* ========================================
   MODAL
   ======================================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    color: var(--primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-sm.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-sm.btn-secondary:hover {
    background: var(--bg-light);
}

/* ========================================
   TOOL CONTAINER
   ======================================== */

.tool-container {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        height: 100vh;
        width: 250px;
        z-index: 999;
        transition: left 0.3s;
    }

    .dashboard-sidebar.open {
        left: 0;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
