/* CRF Web Admin - Base Styles */

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: #1e293b;
    border-right: 1px solid #334155;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #334155;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 5px;
}

.sidebar-header span {
    font-size: 0.75rem;
    color: #64748b;
}

.nav-section {
    padding: 15px 0;
}

.nav-section-title {
    padding: 8px 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover, .nav-item.active {
    background: #334155;
    color: #fff;
}

.nav-item .icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - 260px);
}

.top-bar {
    background: #1e293b;
    border-bottom: 1px solid #334155;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar h2 {
    font-size: 1.2rem;
    color: #fff;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    color: #fff;
    font-weight: 500;
}

.user-role {
    background: #334155;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.page-content {
    padding: 30px;
    flex: 1;
}

/* Cards */
.card {
    background: #1e293b;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid #334155;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #334155;
}

.card-title {
    font-size: 1.1rem;
    color: #fff;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #334155;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.stat-label {
    color: #64748b;
    font-size: 0.85rem;
}

.stat-card.critical .stat-value {
    color: #dc2626;
}

.stat-card.warning .stat-value {
    color: #ca8a04;
}

.stat-card.success .stat-value {
    color: #22c55e;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-success {
    background: #22c55e;
    color: white;
}

.btn-secondary {
    background: #475569;
    color: white;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #94a3b8;
    font-size: 0.85rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #fff;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #334155;
}

th {
    color: #64748b;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
}

td {
    color: #e2e8f0;
}

tr:hover td {
    background: #334155;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #22c55e20;
    color: #22c55e;
    border: 1px solid #22c55e;
}

.alert-danger {
    background: #dc262620;
    color: #dc2626;
    border: 1px solid #dc2626;
}

.alert-warning {
    background: #ca8a0420;
    color: #ca8a04;
    border: 1px solid #ca8a04;
}

.alert-info {
    background: #2563eb20;
    color: #2563eb;
    border: 1px solid #2563eb;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
}

.badge-critical { background: #dc2626; color: white; }
.badge-high { background: #ea580c; color: white; }
.badge-medium { background: #ca8a04; color: white; }
.badge-low { background: #65a30d; color: white; }
.badge-info { background: #2563eb; color: white; }

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: #1e293b;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    border: 1px solid #334155;
}

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

.login-header h1 {
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 10px;
}

.login-header p {
    color: #64748b;
}

.login-card .btn-block {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
}

/* Status Indicators */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-dot.green { background: #22c55e; }
.status-dot.red { background: #dc2626; }
.status-dot.yellow { background: #ca8a04; }

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 1px solid #334155;
    padding-bottom: 10px;
}

.tab {
    padding: 8px 16px;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
}

.tab:hover {
    color: #fff;
}

.tab.active {
    background: #2563eb;
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1e293b;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

/* Code Block */
.code-block {
    background: #0f172a;
    padding: 15px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.85rem;
    color: #22c55e;
    overflow-x: auto;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: #334155;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: #2563eb;
    transition: width 0.3s;
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* Flex utilities */
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
/* ===========================================================================
   TOAST NOTIFICATIONS
   =========================================================================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #1e293b;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    color: #e2e8f0;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success { border-left: 4px solid #22c55e; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-warning { border-left: 4px solid #f59e0b; }
.toast-info { border-left: 4px solid #3b82f6; }

.toast-message { flex: 1; }

.toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    padding: 0 0 0 10px;
}

.toast-close:hover { color: #e2e8f0; }

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

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #1e293b;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.modal-content h3 {
    margin: 0 0 12px;
    color: #f1f5f9;
}

.modal-content p {
    color: #94a3b8;
    margin: 0 0 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 8px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.btn-cancel {
    background: #334155;
    color: #e2e8f0;
}

.btn-confirm {
    background: #3b82f6;
    color: white;
}

/* ===========================================================================
   LOADING SPINNER
   =========================================================================== */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #94a3b8;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===========================================================================
   BREADCRUMBS
   =========================================================================== */

.breadcrumbs {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 16px;
}

.breadcrumbs a {
    color: #64748b;
    text-decoration: none;
}

.breadcrumbs a:hover { color: #3b82f6; }

.breadcrumbs .separator {
    margin: 0 8px;
}

/* ===========================================================================
   PAGINATION
   =========================================================================== */

.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
}

.pagination button {
    padding: 6px 14px;
    background: #334155;
    border: none;
    border-radius: 6px;
    color: #e2e8f0;
    cursor: pointer;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination span { color: #94a3b8; }

/* ===========================================================================
   INVALID INPUT
   =========================================================================== */

input.invalid,
select.invalid,
textarea.invalid {
    border-color: #ef4444 !important;
}
