/* ============================================
   AM-LOGS - Design System
   Inspired by AM-WORKLOAD charter
   ============================================ */

/* --- Base / Typography --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    background-color: #f0f2f5;
    color: #2c3e50;
    margin: 0;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: #2c3e50;
}

/* --- Top Navigation --- */
.top-nav {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 20px;
    max-width: 100%;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.1em;
    letter-spacing: 1px;
    padding-right: 20px;
    border-right: 1px solid rgba(255,255,255,0.15);
    margin-right: 12px;
}

.nav-brand:hover {
    color: white;
}

.nav-brand i {
    font-size: 1.3em;
    color: #667eea;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s;
    border: none;
    background: none;
    cursor: pointer;
    white-space: nowrap;
}

.nav-link-item:hover,
.nav-link-item.active {
    color: white;
    background: rgba(255,255,255,0.1);
}

/* Dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    min-width: 220px;
    z-index: 2000;
    padding: 6px 0;
    margin-top: 8px;
    animation: dropdownFadeIn 0.2s ease;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-dropdown-item:hover {
    background: rgba(102,126,234,0.08);
    color: #667eea;
}

.nav-dropdown-divider {
    height: 1px;
    background: #e9ecef;
    margin: 4px 0;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.7);
    font-size: 0.85em;
    font-weight: 500;
}

.nav-logout {
    color: rgba(255,255,255,0.5) !important;
    padding: 6px 10px !important;
}

.nav-logout:hover {
    color: #e74c3c !important;
    background: rgba(231,76,60,0.15) !important;
}

/* --- Main Container --- */
.main-container {
    flex: 1;
    padding: 20px 25px;
    max-width: 100%;
}

/* --- Footer --- */
.app-footer {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 15px 0;
    font-size: 0.85em;
}

/* --- Notifications --- */
.notification {
    padding: 14px 22px;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.9em;
    animation: slideIn 0.3s ease;
}

.notification-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.notification-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- Header Bar --- */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.header-bar h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 700;
    display: flex;
    align-items: center;
}

/* --- Cards --- */
.card {
    background: white;
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
}

.card-header {
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 14px 20px;
    font-weight: 600;
}

.card-header h6 {
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
}

.card-body {
    padding: 20px;
}

/* --- Stat Cards (AM-WORKLOAD style) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 22px 24px;
    min-height: 100px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-left: 5px solid #dee2e6;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.stat-card-purple { border-left-color: #667eea; }
.stat-card-green { border-left-color: #27ae60; }
.stat-card-red { border-left-color: #e74c3c; }
.stat-card-blue { border-left-color: #3498db; }
.stat-card-orange { border-left-color: #f39c12; }

.stat-icon {
    position: absolute;
    top: 18px;
    right: 20px;
    font-size: 1.8em;
    opacity: 0.1;
    pointer-events: none;
    color: #2c3e50;
}

.stat-value {
    font-size: 1.7em;
    font-weight: 800;
    color: #2c3e50;
    line-height: 1.2;
    margin-bottom: 4px;
    padding-right: 40px;
}

.stat-label {
    font-size: 0.82em;
    color: #6c757d;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* --- Buttons --- */
.btn {
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    padding: 10px 18px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a4292);
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #219a52, #27ae60);
    box-shadow: 0 4px 15px rgba(39,174,96,0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #d63a2c, #b33426);
    box-shadow: 0 4px 15px rgba(231,76,60,0.4);
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
    border: none;
}

.btn-secondary:hover {
    background: #dfe6e9;
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
}

.btn-outline-primary:hover {
    background: #667eea;
    color: white;
}

.btn-outline-secondary {
    background: transparent;
    border: 2px solid #dee2e6;
    color: #6c757d;
}

.btn-outline-secondary:hover {
    background: #ecf0f1;
    color: #2c3e50;
    border-color: #dee2e6;
}

.btn-outline-warning {
    background: transparent;
    border: 2px solid #f39c12;
    color: #f39c12;
}

.btn-outline-warning:hover {
    background: #f39c12;
    color: white;
}

.btn-outline-danger {
    background: transparent;
    border: 2px solid #e74c3c;
    color: #e74c3c;
}

.btn-outline-danger:hover {
    background: #e74c3c;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.82em;
    border-radius: 8px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1em;
}

/* --- Forms --- */
.form-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
    margin-bottom: 6px;
}

.form-control,
.form-select {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95em;
    outline: none;
    transition: all 0.3s;
    background: white;
}

.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.form-check-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.input-group-text {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px 0 0 10px;
    color: #6c757d;
}

.input-group .form-control {
    border-radius: 0 10px 10px 0;
}

/* --- Tables --- */
.table {
    font-size: 0.9em;
}

.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: #6c757d;
    border-bottom: 2px solid #e9ecef;
}

.table td {
    vertical-align: middle;
}

/* --- Badges --- */
.badge {
    font-weight: 600;
    font-size: 0.8em;
    padding: 5px 10px;
    border-radius: 6px;
}

/* --- Filters bar --- */
.filters-bar {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.filters-bar .form-label {
    font-size: 0.85em;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 4px;
}

.filters-bar .form-control,
.filters-bar .form-select {
    min-width: 150px;
    padding: 8px 12px;
    font-size: 0.9em;
}

/* --- Modals --- */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header .modal-title {
    font-size: 1.2em;
    font-weight: 700;
    color: #2c3e50;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #e9ecef;
}

/* --- Login page --- */
.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    padding: 40px;
    max-width: 440px;
    margin: 0 auto;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo i {
    font-size: 3em;
    color: #667eea;
}

.login-logo h2 {
    margin-top: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

/* --- Seed page --- */
.seed-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    text-align: center;
    padding: 50px 40px;
}

.seed-card .display-1 {
    margin-bottom: 15px;
}

/* --- Pre / Code --- */
pre {
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
    border-radius: 8px;
}

code {
    font-size: 0.85em;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    height: 10px;
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f0f2f5;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a4292);
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .top-nav {
        height: auto;
        padding: 10px 0;
    }

    .nav-container {
        flex-direction: column;
        gap: 8px;
    }

    .nav-left {
        flex-direction: column;
        width: 100%;
    }

    .nav-links {
        flex-wrap: wrap;
    }

    .nav-brand {
        border-right: none;
        margin-right: 0;
        padding-right: 0;
    }

    .main-container {
        padding: 15px;
    }

    .header-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-value {
        font-size: 1.4em;
    }

    .stat-card {
        padding: 16px 18px;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filters-bar .form-control,
    .filters-bar .form-select {
        min-width: 100%;
    }
}

/* --- AG Grid theme override --- */
.ag-theme-alpine {
    --ag-border-radius: 8px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.ag-theme-alpine .ag-row.cursor-pointer,
.cursor-pointer .ag-row {
    cursor: pointer;
}

.ag-theme-alpine .ag-row:hover {
    background-color: rgba(102,126,234,0.05) !important;
}
