/**
 * TiCuDoA - Windows Phone Style CSS
 * Large tiles, clean typography, modern dark theme
 */

:root {
    /* Color Palette */
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --accent-blue: #4361ee;
    --accent-purple: #7209b7;
    --accent-pink: #f72585;
    --accent-cyan: #4cc9f0;
    --accent-green: #06d6a0;
    --accent-yellow: #ffd166;
    --accent-orange: #ef476f;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #6c757d;

    /* Tile Colors */
    --tile-users: #4361ee;
    --tile-companies: #7209b7;
    --tile-contacts: #f72585;
    --tile-projects: #4cc9f0;
    --tile-time: #06d6a0;
    --tile-notes: #ffd166;
    --tile-receipts: #ef476f;
    --tile-photos: #3a86ff;
    --tile-reports: #8338ec;

    /* Spacing */
    --tile-gap: 12px;
    --tile-radius: 8px;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Navbar */
.navbar {
    background: rgba(26, 26, 46, 0.95) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    top: 0;
    padding-top: 8px;
    padding-bottom: 8px;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.company-indicator {
    color: var(--accent-cyan) !important;
    font-size: 0.85rem;
}

/* Navbar Spacer - space for fixed navbar */
.navbar-spacer {
    height: 80px;
}

/* Offline Banner */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--accent-orange);
    color: white;
    text-align: center;
    padding: 8px;
    z-index: 9999;
    font-weight: 500;
}

/* Tiles Grid */
.tiles-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--tile-gap);
    padding: var(--tile-gap);
}

@media (min-width: 768px) {
    .tiles-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .tiles-container {
        grid-template-columns: repeat(4, 1fr);
        max-width: 1000px;
        margin: 0 auto;
    }
}

/* Single Tile */
.tile {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    border-radius: var(--tile-radius);
    text-decoration: none;
    color: white;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    min-height: 140px;
}

.tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.tile:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    color: white;
    text-decoration: none;
}

.tile:active {
    transform: scale(0.98);
}

.tile-icon {
    font-size: 2.5rem;
    opacity: 0.9;
}

.tile-label {
    font-size: 1.1rem;
    font-weight: 500;
    margin-top: auto;
}

.tile-count {
    font-size: 2rem;
    font-weight: 700;
    position: absolute;
    top: 15px;
    right: 15px;
    opacity: 0.8;
}

/* Tile Colors */
.tile-users {
    background: var(--tile-users);
}

.tile-companies {
    background: var(--tile-companies);
}

.tile-contacts {
    background: var(--tile-contacts);
}

.tile-projects {
    background: var(--tile-projects);
}

.tile-time {
    background: var(--tile-time);
}

.tile-notes {
    background: var(--tile-notes);
    color: #333;
}

.tile-receipts {
    background: var(--tile-receipts);
}

.tile-photos {
    background: var(--tile-photos);
}

.tile-reports {
    background: var(--tile-reports);
}

/* Wide Tile */
.tile-wide {
    grid-column: span 2;
    aspect-ratio: 2/1;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--tile-radius);
    color: var(--text-primary);
}

.card-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

/* Forms */
.form-control,
.form-select {
    background: rgba(15, 52, 96, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    border-radius: var(--tile-radius);
    padding: 12px 16px;
    font-size: 1rem;
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 12px;
    padding-right: 40px;
}

.form-select option {
    background: #0f3460;
    color: #ffffff;
}

.form-control:focus,
.form-select:focus {
    background: rgba(15, 52, 96, 1);
    border-color: var(--accent-cyan);
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.25);
}

.form-control::placeholder {
    color: #a0a0a0;
}

.form-label {
    font-weight: 500;
    margin-bottom: 8px;
    color: #e0e0e0;
}

/* Buttons */
.btn {
    border-radius: var(--tile-radius);
    padding: 12px 24px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.btn-primary:hover {
    background: #3651d4;
    border-color: #3651d4;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.btn-danger {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

/* Tables */
.table {
    color: #ffffff;
    --bs-table-bg: transparent;
    --bs-table-color: #ffffff;
}

.table thead th {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table tbody td {
    border-color: rgba(255, 255, 255, 0.1);
    vertical-align: middle;
    color: #ffffff;
}

.table tbody tr {
    background: rgba(15, 52, 96, 0.5);
}

.table-hover tbody tr:hover {
    background: rgba(67, 97, 238, 0.3);
    --bs-table-hover-bg: transparent;
}

/* List Groups */
.list-group-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 16px 20px;
}

.list-group-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Dropdowns */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--tile-radius);
}

.dropdown-item {
    color: var(--text-primary);
    padding: 10px 16px;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Modals */
.modal-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--tile-radius);
}

.modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.modal-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.btn-close {
    filter: invert(1);
}

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
}

/* Page Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0;
    color: #ffffff;
}

/* Text Colors Override for Dark Theme */
.text-muted {
    color: #a0a0a0 !important;
}

/* Company Selector */
.company-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px;
}

.company-card {
    background: var(--bg-card);
    border-radius: var(--tile-radius);
    padding: 24px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.company-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
}

.company-card.active {
    border-color: var(--accent-green);
}

.company-card h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.company-card p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo i {
    font-size: 4rem;
    color: var(--accent-cyan);
}

.login-logo h1 {
    font-size: 2rem;
    margin-top: 16px;
}

/* Alerts */
.alert {
    border-radius: var(--tile-radius);
    border: none;
}

.alert-success {
    background: rgba(6, 214, 160, 0.2);
    color: var(--accent-green);
}

.alert-danger {
    background: rgba(239, 71, 111, 0.2);
    color: var(--accent-orange);
}

.alert-warning {
    background: rgba(255, 209, 102, 0.2);
    color: var(--accent-yellow);
}

/* Hours Select */
.hours-select {
    width: 120px;
}

/* Image Preview */
.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--tile-radius);
    margin-top: 12px;
}

/* Camera Capture */
.camera-container {
    position: relative;
    background: #000;
    border-radius: var(--tile-radius);
    overflow: hidden;
}

.camera-container video {
    width: 100%;
    display: block;
}

.camera-controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
}

.capture-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: white;
    border: 4px solid var(--accent-cyan);
    cursor: pointer;
    transition: all 0.2s ease;
}

.capture-btn:hover {
    transform: scale(1.1);
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--bg-card);
    border-radius: var(--tile-radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.pwa-install-banner p {
    margin: 0;
    font-size: 0.95rem;
}