/* Infynidex Inc. Expense Tracker Application - Mobile-First Design */

:root {
    --primary-color: #097AE4;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

/* Constrain header on mobile to prevent logo from expanding */
@media (max-width: 767px) {
    .header-content {
        padding: 0 0.5rem;
    }
}

.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.logo-image {
    max-height: 50px;
    width: auto;
    height: auto;
    display: block;
    max-width: 100%;
}

/* Responsive logo sizing for mobile */
@media (max-width: 767px) {
    .logo-image {
        max-width: 200px;
        max-height: 40px;
        width: auto;
        height: auto;
    }
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Navigation */
.nav {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-list {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    min-width: max-content;
}

.nav-item {
    flex-shrink: 0;
}

.nav-link {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

/* Buttons - Thumb-friendly sizing */
.btn {
    display: inline-block;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
    min-width: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-sm {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    min-height: 40px;
}

.btn-lg {
    padding: 1.25rem 2rem;
    font-size: 1.125rem;
    min-height: 56px;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
    min-height: 48px;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-help {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Tables */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    position: sticky;
    top: 0;
}

.table tr:hover {
    background: var(--bg-secondary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-primary);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Deliveries page tabs - reuse nav-list / nav-item / nav-link for same button style */
.delivery-tabs {
    margin-bottom: 1.25rem;
}

/* Time Tracker */
.time-tracker {
    text-align: center;
    padding: 2rem 1rem;
}

.current-time {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 1rem 0;
    font-variant-numeric: tabular-nums;
}

.time-status {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.punch-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Image Preview */
.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    border: 2px solid var(--border-color);
}

.image-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 2rem;
    text-align: center;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all 0.2s;
}

.image-upload-area:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.image-upload-area input[type="file"] {
    display: none;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--danger-color); }
.text-success { color: var(--secondary-color); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.hidden { display: none; }

/* Hamburger Menu Toggle Button */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.nav-toggle span {
    width: 100%;
    height: 3px;
    background: var(--text-primary);
    border-radius: 3px;
    transition: all 0.3s;
}

.nav-toggle-active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.nav-toggle-active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle-active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu - Hamburger for all mobile */
@media (max-width: 767px) {
    /* Hamburger menu */
    .nav-toggle {
        display: flex;
    }
    
    /* Hide nav by default, show when toggled */
    .nav {
        display: none;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-md);
    }
    
    .nav-open {
        display: block;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
    }
    
    .nav-item {
        width: 100%;
    }
    
    .nav-link {
        padding: 1rem 1.5rem;
        border-radius: 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
}

/* Portrait Mode Specific Adjustments */
@media (max-width: 767px) and (orientation: portrait) {
    /* Header adjustments */
    .header-content {
        padding: 0.75rem 0.5rem;
    }
    
    .user-menu {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    
    .user-name {
        display: none;
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
        min-height: 36px;
        min-width: auto;
    }
    
    /* Table adjustments for portrait */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    .table {
        font-size: 0.875rem;
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }
    
    /* Card padding adjustment for tables */
    .card {
        padding: 1rem;
        overflow: hidden;
    }
    
    /* Container padding */
    .container {
        padding: 1rem 0.75rem;
    }
}

/* Responsive */
@media (min-width: 768px) {
    .container {
        padding: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .nav-list {
        justify-content: center;
    }
}

/* Print Styles */
@media print {
    .header,
    .nav,
    .btn,
    .no-print {
        display: none !important;
    }
}

