﻿/* ===== VARIABLES ===== */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --dark-color: #333;
    --light-color: #f5f5f5;
    --border-radius: 10px;
    --box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== BASE ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

/* ===== LOGIN ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    z-index: 9999;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

    .login-box h2 {
        color: var(--dark-color);
        margin-bottom: 30px;
        text-align: center;
        font-size: 28px;
    }

    .login-box input {
        width: 100%;
        padding: 12px;
        border: 2px solid #e5e7eb;
        border-radius: var(--border-radius);
        font-size: 16px;
        margin-bottom: 20px;
        transition: var(--transition);
    }

        .login-box input:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }

    .login-box button {
        width: 100%;
        padding: 14px;
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        color: white;
        border: none;
        border-radius: var(--border-radius);
        font-size: 18px;
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition);
    }

        .login-box button:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
        }

.login-error {
    color: var(--danger-color);
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background: #f8d7da;
    border-radius: 5px;
    display: none;
}

    .login-error.show {
        display: block;
    }

/* ===== HEADER ===== */
.header {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--box-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .header h1 {
        color: var(--dark-color);
        display: flex;
        align-items: center;
        gap: 10px;
    }

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
    transition: var(--transition);
}

    .stat-card:hover {
        transform: translateY(-5px);
    }

    .stat-card .number {
        font-size: 36px;
        font-weight: bold;
        color: var(--primary-color);
    }

    .stat-card .label {
        color: #666;
        margin-top: 5px;
    }

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.quick-action-card {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

    .quick-action-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    }

    .quick-action-card .icon {
        font-size: 48px;
        margin-bottom: 15px;
    }

    .quick-action-card h3 {
        color: var(--dark-color);
        margin-bottom: 10px;
    }

    .quick-action-card p {
        color: #666;
        font-size: 14px;
    }

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: white;
    padding: 10px;
    border-radius: var(--border-radius);
    overflow-x: auto;
}

.tab {
    padding: 10px 20px;
    background: var(--light-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

    .tab.active {
        background: var(--primary-color);
        color: white;
    }

/* ===== CONTENT ===== */
.content {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
    min-height: 400px;
}

/* ===== TABLES ===== */
.table {
    width: 100%;
    border-collapse: collapse;
}

    .table th {
        background: var(--light-color);
        padding: 12px;
        text-align: left;
        font-weight: 600;
        border-bottom: 2px solid #ddd;
    }

    .table td {
        padding: 12px;
        border-bottom: 1px solid #eee;
    }

/* ===== STATUS BADGES ===== */
.status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

    .status.active {
        background: #d4edda;
        color: #155724;
    }

    .status.trial {
        background: #fff3cd;
        color: #856404;
    }

    .status.suspended {
        background: #f8d7da;
        color: #721c24;
    }

/* ===== BUTTONS ===== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    margin: 0 2px;
}

    .btn:hover {
        opacity: 0.9;
        transform: translateY(-2px);
    }

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: #333;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

    .modal.show {
        display: flex;
    }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid #e0e0e0;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

    .form-group label {
        display: block;
        margin-bottom: 5px;
        font-weight: 600;
        color: var(--dark-color);
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 5px;
        font-size: 14px;
        transition: var(--transition);
    }

        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: var(--primary-color);
        }

/* ===== ALERTS ===== */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: none;
}

    .alert.show {
        display: block;
    }

    .alert.success {
        background: #d4edda;
        color: #155724;
        border: 1px solid #c3e6cb;
    }

    .alert.error {
        background: #f8d7da;
        color: #721c24;
        border: 1px solid #f5c6cb;
    }

    .alert.warning {
        background: #fff3cd;
        color: #856404;
        border: 1px solid #ffeeba;
    }

/* ===== UTILITIES ===== */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

    .search-box input {
        flex: 1;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 5px;
    }

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.badge {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 5px;
}

    .badge.success {
        background: var(--success-color);
    }

    .badge.danger {
        background: var(--danger-color);
    }

    .badge.warning {
        background: var(--warning-color);
    }

.empty-state {
    text-align: center;
    padding: 60px;
    color: #999;
}

/* Progress bar for ingestion jobs */
.progress {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin: 5px 0;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    transition: width 0.3s ease;
}

/* Security sections */
.security-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

    .security-section h3 {
        margin-bottom: 15px;
        color: #333;
    }

/* Pagination */
.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
}

    .pagination button {
        min-width: 30px;
    }

        .pagination button.active {
            background: var(--primary-color);
            color: white;
        }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .table {
        font-size: 12px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }
}
