:root {
    --bg-dark: #0a0c10;
    --bg-card: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --accent: #60a5fa;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --glass-bg: rgba(20, 20, 30, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    padding: 1.5rem;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: 'Outfit', sans-serif;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Glassmorphism */
.glass-morphism {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Header & Logo */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 2rem;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.logo-img {
    height: 10rem;
    width: 10rem;
    object-fit: cover;
    border-radius: 50%;
}

.logo h1 {
    display: flex;
    flex-direction: column;
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 0.85;
}

.logo-sub {
    margin-left: 2rem;
    font-size: 3.5rem;
}

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

/* Stats Card */
.stats-dashboard {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1.5rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#login-btn {
    margin-left: 0;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.sync-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.sync-badge.synced {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.sync-badge.offline {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.sync-badge.connecting {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

.status-icon {
    font-size: 0.9rem;
}

.stat-card {
    min-width: 280px;
    text-align: center;
    border-color: var(--primary-glow);
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    display: block;
    font-size: 3rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary-glow);
}

.unit {
    font-size: 1.5rem;
    font-weight: 500;
    margin-left: -0.5rem;
}

.sub-unit {
    display: block;
    font-size: 1.25rem;
    color: var(--text-dim);
    font-weight: 400;
    margin-top: 0.25rem;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-style: italic;
}

/* Form Styling */
.entry-section {
    margin-bottom: 3rem;
}

.entry-section h2 {
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dim);
}

input, select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

select option {
    background: #1e293b;
    color: white;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706) !important;
}

.btn-secondary {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 1rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-color: white;
}

/* History Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.filters {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Table Styling */
.table-wrapper {
    overflow-x: auto;
    padding: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 1.25rem 1.5rem;
    color: var(--text-dim);
    font-weight: 500;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem !important;
    color: var(--text-dim);
    font-style: italic;
    font-size: 0.95rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-arrived { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.status-in-transit { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--danger);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

/* Notifications */
#notification-area {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 1000;
}

.notification {
    padding: 1rem 1.5rem !important;
    border-radius: 1rem !important;
    border-color: var(--primary) !important;
    font-size: 0.875rem;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.modal-content {
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: var(--text-dim);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.hidden {
    display: none !important;
}

/* Admin Utility Classes */
.admin-only {
    transition: all 0.3s ease;
}

/* Specific elements to hide/show */
.admin-hidden {
    display: none !important;
}

.read-only-mark {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-style: italic;
    opacity: 0.7;
}
