/* Custom CSS for Gmail Dashboard */

/* Light mode support (default) */
[data-bs-theme="light"], :root {
    --bs-body-bg: #ffffff;
    --bs-body-color: #212529;
    --bs-card-bg: #ffffff;
    --bs-card-cap-bg: #f8f9fa;
    --bs-border-color: #dee2e6;
    --bs-tertiary-bg: #f8f9fa;
    --bs-list-group-bg: #ffffff;
    --bs-primary: #0d6efd;
}

/* Body and Layout */
body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Navigation */
.navbar-brand {
    font-weight: 600;
}

/* Cards */
.card {
    background-color: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--bs-card-cap-bg);
    border-bottom: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    font-weight: 500;
}

/* Buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* Forms */
.form-control {
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    background-color: var(--bs-body-bg);
    border-color: var(--bs-primary);
    color: var(--bs-body-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-label {
    color: var(--bs-body-color);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Tables */
.table {
    color: var(--bs-body-color);
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid var(--bs-border-color);
    font-weight: 600;
    color: var(--bs-body-color);
}

.table tbody tr:hover {
    background-color: var(--bs-tertiary-bg);
}

/* Badges */
.badge {
    font-size: 0.75em;
    font-weight: 500;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.5rem;
}

.alert-dismissible .btn-close {
    padding: 1.25rem 1rem;
}

/* List Groups */
.list-group-item {
    background-color: var(--bs-list-group-bg);
    border: none;
    border-bottom: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    transition: background-color 0.15s ease-in-out;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background-color: var(--bs-tertiary-bg);
}

/* Avatar */
.avatar-sm {
    font-weight: 600;
    font-size: 12px;
}

/* Hero Section */
.hero-section {
    padding: 4rem 0;
}

.hero-section .display-1 {
    font-size: 4rem;
}

/* Footer */
footer {
    margin-top: auto;
    border-top: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

/* Connection Status */
#connection-status {
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

/* Loading States */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 0;
    }
    
    .hero-section .display-1 {
        font-size: 2.5rem;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-group-sm > .btn, .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Dark mode support */
[data-bs-theme="dark"] {
    --bs-body-bg: #121212 !important;
    --bs-body-color: #e0e0e0 !important;
    --bs-card-bg: #1e1e1e !important;
    --bs-card-cap-bg: #252525 !important;
    --bs-border-color: #333 !important;
    --bs-tertiary-bg: #2a2a2a !important;
    --bs-form-control-bg: #2a2a2a !important;
    --bs-form-control-border-color: #444 !important;
    --bs-form-control-color: #e0e0e0 !important;
    --bs-navbar-bg: #1a1a1a !important;
    --bs-table-bg: transparent !important;
    --bs-table-striped-bg: #252525 !important;
    --bs-table-hover-bg: #2a2a2a !important;
    --bs-list-group-bg: #1e1e1e !important;
    --bs-list-group-border-color: #333 !important;
}

/* Dark mode specific styles */
[data-bs-theme="dark"] body {
    background-color: #121212 !important;
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .container,
[data-bs-theme="dark"] main {
    background-color: transparent;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .navbar {
    background-color: #1a1a1a !important;
    border-bottom: 1px solid #333;
}

[data-bs-theme="dark"] .navbar-brand,
[data-bs-theme="dark"] .navbar-nav .nav-link {
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .navbar-nav .nav-link:hover {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .card {
    background-color: #1e1e1e !important;
    border-color: #333 !important;
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .btn-primary {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-outline-primary {
    border-color: #0d6efd !important;
    color: #0d6efd !important;
}

[data-bs-theme="dark"] .btn-outline-primary:hover {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .card-header {
    background-color: #252525;
    border-bottom-color: #333;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .table {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .table thead th {
    border-bottom-color: #444;
    color: #f0f0f0;
}

[data-bs-theme="dark"] .table tbody tr:hover {
    background-color: #2a2a2a;
}

[data-bs-theme="dark"] .form-control {
    background-color: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .form-control:focus {
    background-color: #2a2a2a;
    border-color: #0d6efd;
    color: #e0e0e0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: #999;
}

[data-bs-theme="dark"] .form-label {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .list-group-item {
    background-color: #1e1e1e;
    border-color: #333;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .list-group-item:hover {
    background-color: #2a2a2a;
}

[data-bs-theme="dark"] .alert {
    border-color: #444;
}

[data-bs-theme="dark"] .alert-info {
    background-color: #1a2332;
    border-color: #2e5984;
    color: #7db3d3;
}

[data-bs-theme="dark"] .alert-success {
    background-color: #1a2e1a;
    border-color: #2e5a2e;
    color: #75b798;
}

[data-bs-theme="dark"] .alert-warning {
    background-color: #332b1a;
    border-color: #664f1a;
    color: #ffda6a;
}

[data-bs-theme="dark"] .alert-danger {
    background-color: #331a1a;
    border-color: #662e2e;
    color: #f1919a;
}

[data-bs-theme="dark"] .badge {
    --bs-badge-color: #000;
}

[data-bs-theme="dark"] .badge.bg-success {
    --bs-badge-color: #000;
}

[data-bs-theme="dark"] .badge.bg-danger {
    --bs-badge-color: #fff;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: #6c757d;
    color: #6c757d;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

[data-bs-theme="dark"] .text-muted {
    color: #999 !important;
}

[data-bs-theme="dark"] .border {
    border-color: #333 !important;
}

[data-bs-theme="dark"] .border-top {
    border-top-color: #333 !important;
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1e1e1e !important;
    border-color: #333 !important;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #2a2a2a !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .nav-link {
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .btn-link {
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .border-bottom {
    border-bottom-color: #333 !important;
}

/* Auto dark mode support for system preference */
@media (prefers-color-scheme: dark) {
    html:not([data-bs-theme]) {
        --bs-body-bg: #121212;
        --bs-body-color: #e0e0e0;
    }
    
    html:not([data-bs-theme]) body {
        background-color: #121212;
        color: #e0e0e0;
    }
}

/* Custom utility classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shadow-sm-hover:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in-up {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
