/* =========================================================================
   APPLICATION STYLES (Views, Dashboard, Components)
   ========================================================================= */

/* App Container */
.app-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Base View Class */
.view {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================================
   LOGIN & AUTH VIEW
   ========================================================================= */
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    z-index: 10;
}

.auth-header {
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-header i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: inline-block;
}

.auth-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
}

.otp-inputs {
    position: relative;
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    margin: 1.5rem 0;
}

/* Invisible real input — covers entire otp-inputs area for iOS SMS autofill */
.otp-real-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 10;
    cursor: text;
    font-size: 16px; /* prevent iOS zoom */
    border: none;
    background: transparent;
    caret-color: transparent;
}

/* Visual digit boxes */
.otp-box {
    width: 2.8rem;
    height: 3.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none;
}
.otp-box.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.otp-box.filled {
    border-color: var(--primary);
}

/* Modals */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8) !important;
    backdrop-filter: blur(10px) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: var(--bg-surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    border: var(--glass-border);
    max-width: 400px;
    width: 90%;
}

.icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}


/* =========================================================================
   DASHBOARD VIEW
   ========================================================================= */
#view-dashboard {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 1.5rem;
    gap: 1.5rem;
}

/* Top Navigation */
.top-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0.75rem 1.5rem;
    min-height: 80px;
    flex-shrink: 0;
    gap: 1rem;
}

.nav-datetime {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.nav-brand i {
    font-size: 2rem;
}

.nav-titles h1 {
    font-size: 1.25rem;
    margin: 0;
}

.role-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.5rem;
}

.nav-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
}

/* Weather Widget */
.weather-widget {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-weight: 500;
}

.weather-widget img {
    width: 24px;
    height: 24px;
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--primary);
}


/* =========================================================================
   RESPONSIVE JOB ROW LIST
   ========================================================================= */
.job-row-wrapper {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem 2rem 1rem;
}

.job-row-wrapper::-webkit-scrollbar {
    display: none;
}

.lang-toggle {
    padding: 0 0.5rem;
}

.job-row-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Table Header (Desktop Only) */
.job-table-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
}

.th-col {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.th-col.sortable {
    cursor: pointer;
    transition: color 0.15s;
}

.th-col.sortable:hover {
    color: var(--primary);
}

/* Base Job Row (Desktop view by default) */
.job-row {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: var(--glass-border);
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.job-row.active-row {
    border-left: 4px solid var(--warning);
    background: #fffbeb;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.1);
}

.job-row.muted {
    opacity: 0.7;
    background: #fafafa;
}

/* Columns */
.row-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.col-status {
    flex: 0.6;
}

.col-id {
    flex: 1;
}

.col-loc {
    flex: 1.5;
}

.col-timing {
    flex: 1.5;
}

.col-photos {
    flex: 2;
}

.col-actions {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Body: Photo Workflow */
.row-photos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    background: var(--bg-base);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    min-width: 270px;
    flex-direction: row;
}

.photo-slot {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-thumb {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    position: relative;
    overflow: hidden;
    background: var(--bg-surface);
    border: 2px dashed var(--border-color);
}

.photo-thumb.has-image {
    border: none;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.time-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 8px;
    white-space: nowrap;
}

.photo-thumb.style-issue {
    color: #ef4444;
    border-color: #fca5a5;
    background: #fef2f2;
}

.photo-thumb.style-progress {
    color: var(--primary);
    border-color: var(--primary);
    background: #eef2ff;
}

.photo-thumb.disabled {
    color: var(--text-muted);
    border-color: var(--border-color);
    background: var(--bg-surface);
    opacity: 0.5;
}

.cursor-pointer {
    cursor: pointer;
}

.photo-thumb.cursor-pointer:hover {
    transform: scale(1.05);
    transition: transform 0.2s;
}

/* Create New Item Row */
.create-row {
    background: transparent;
    border: 2px dashed var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-shadow: none;
    cursor: pointer;
}

.create-row:hover {
    background: var(--bg-surface);
    border-color: var(--primary);
}

.camera-cta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cta-text {
    display: flex;
    flex-direction: column;
}

/* Tags & Helpers */
.tag {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    width: fit-content;
}

.tag-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.tag-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.tag-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
}

.btn-success:hover {
    background: #059669;
}

.btn-xs {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

.font-bold {
    font-weight: 700;
}

.ml-2 {
    margin-left: 0.5rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* Language toggle buttons */
.lang-btn {
    cursor: pointer;
    opacity: 0.45;
    transition: opacity 0.15s, color 0.15s;
}
.lang-btn.active {
    opacity: 1;
    font-weight: 700;
    color: var(--primary);
}
.lang-btn:hover { opacity: 0.8; }

/* Responsive Adjustments for Mobile */
@media (max-width: 768px) {
    .hidden-mobile {
        display: none !important;
    }

    /* view-dashboard: enable vertical scroll */
    #view-dashboard {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Top nav: sticky + compact + flex-wrap */
    .top-nav {
        position: sticky;
        top: 0;
        z-index: 50;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        padding: 0.4rem 1rem 0.45rem;
        min-height: auto;
        gap: 0.15rem;
        transition: transform 0.28s ease;
    }
    .top-nav.header-hidden {
        transform: translateY(-110%);
    }
    /* Row 1: brand (left) + nav-right (right) */
    .nav-brand { order: 1; flex: 1; }
    .nav-right { order: 2; }
    /* Row 2: date/time full width */
    .nav-datetime {
        order: 3;
        width: 100%;
        flex-direction: row;
        justify-content: center;
        gap: 0.75rem;
        align-items: center;
    }
    .nav-datetime h2 { font-size: 0.78rem; margin: 0; }
    .nav-datetime p  { font-size: 0.7rem; margin: 0; }

    .job-row {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }

    .row-col {
        width: 100%;
        text-align: left;
    }

    /* Change ID/Status column to horizontal wrapper on mobile */
    .col-status,
    .col-id {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed var(--border-color);
        padding-bottom: 0.5rem;
        margin-bottom: 0.25rem;
    }

    .col-status .mb-1,
    .col-id .mb-1 {
        margin-bottom: 0;
    }

    .col-loc,
    .col-timing {
        margin-bottom: 0.5rem;
    }

    .timing-item {
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }

    .row-photos {
        padding: 0.6rem;
        margin-top: 0.5rem;
        gap: 0.5rem;
    }

    .photo-thumb {
        width: 100%;
        height: 140px;
        font-size: 2.5rem;
    }

    .row-actions {
        margin-top: 0.5rem;
    }

    .col-actions button {
        width: 100%;
    }
}
/* Hide camera CTA on desktop — photos are taken on mobile only */
@media (min-width: 769px) {
    .create-row {
        display: none !important;
    }
}
