/* ==================== BASE STYLES ==================== */
:root {
    --primary-color: #29444a;
    --primary-light: #3d5a62;
    --primary-dark: #1e3338;
    --accent-color: #4a90a4;
    --text-light: #ffffff;
    --text-dark: #212529;
    --border-color: #29444a;
    --bg-light: #f8f9fa;
}

/* Prevent mobile browser scroll issues */
html, body {
    height: 100%;
    height: 100dvh; /* Dynamic viewport height for mobile */
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
}

/* ==================== LAYOUT ==================== */
.main-app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
    width: 100%;
    max-width: 100%;
    padding: 0;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
}

body.vh-100 {
    height: 100%;
    height: 100dvh;
}

/* ==================== HEADER ==================== */
.main-header {
    background-color: var(--primary-color) !important;
    padding: 8px 12px;
    flex-shrink: 0;
}

.main-header .navbar-brand {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
}

.online-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-light);
    font-size: 0.75rem;
}

.online-badge i {
    font-size: 0.5rem;
}

.status-text {
    display: none;
}

@media (min-width: 400px) {
    .status-text {
        display: inline;
    }
}

/* ==================== FIXED TOP SECTION ==================== */
#fixed-top-section {
    flex-shrink: 0;
    background-color: var(--bg-light);
}

.filter-section {
    padding: 8px 12px;
    background-color: white;
    border-bottom: 1px solid #dee2e6;
}

.filter-section .form-select {
    border-color: var(--border-color);
    font-size: 0.85rem;
}

/* ==================== TAB NAVIGATION ==================== */
.tab-section {
    background-color: white;
    border-bottom: 2px solid var(--primary-color);
}

#screen-tab {
    border: none;
    padding: 0;
}

#screen-tab .nav-item {
    flex: 1;
}

#screen-tab .nav-link {
    border: none;
    border-radius: 0;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.8rem;
    padding: 10px 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    background-color: #e9ecef;
    transition: all 0.2s ease;
}

#screen-tab .nav-link i {
    font-size: 1rem;
}

#screen-tab .nav-link span {
    font-size: 0.75rem;
}

#screen-tab .nav-link.active {
    background-color: var(--primary-color);
    color: var(--text-light);
}

#screen-tab .nav-link:not(.active):hover {
    background-color: #dde2e6;
}

/* iPhone SE and small screens */
@media (max-width: 375px) {
    #screen-tab .nav-link {
        font-size: 0.7rem;
        padding: 8px 4px;
    }
    
    #screen-tab .nav-link i {
        font-size: 0.9rem;
    }
    
    #screen-tab .nav-link span {
        font-size: 0.65rem;
    }
}

/* ==================== ACTIVITY CARDS CONTAINER ==================== */
#table-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    background-color: var(--bg-light);
}

.activity-cards-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 10px;
}

/* ==================== ACTIVITY CARD ==================== */
.activity-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.activity-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.activity-card:active {
    transform: translateY(0);
}

.activity-card .activity-header {
    margin-bottom: 4px;
}

.activity-card .activity-id {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.activity-card .activity-name {
    color: var(--primary-color);
    font-size: 0.85rem;
}

.activity-card .activity-details {
    color: var(--accent-color);
    font-size: 0.8rem;
    line-height: 1.3;
}

.activity-card .planned-date {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 4px;
}

.activity-card.syncing::after {
    content: ' 🔄';
}

/* ==================== DELAY CARD ==================== */
.delay-card {
    background: white;
    border: 2px solid #dc3545;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delay-card:hover {
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
    transform: translateY(-1px);
}

.delay-card:active {
    transform: translateY(0);
}

.delay-card .delay-header {
    margin-bottom: 4px;
}

.delay-card .delay-reason {
    font-weight: 700;
    color: #dc3545;
    font-size: 0.9rem;
}

.delay-card .delay-details {
    color: #6c757d;
    font-size: 0.8rem;
    line-height: 1.3;
}

.delay-card .delay-location {
    font-size: 0.8rem;
    color: var(--accent-color);
}

.delay-card .delay-date {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 4px;
}

.delay-card .delay-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.delay-card .delay-status.pending {
    background-color: #ffc107;
    color: #212529;
}

.delay-card .delay-status.completed {
    background-color: #28a745;
    color: white;
}

.delay-card.syncing::after {
    content: ' 🔄';
}

/* ==================== REFRESH SECTION ==================== */
#refresh-section {
    flex-shrink: 0;
    padding: 8px 12px 12px;
    background-color: var(--bg-light);
    border-top: 1px solid #dee2e6;
}

.refresh-btn {
    background-color: var(--primary-color);
    border: none;
    color: var(--text-light);
    /* font-weight: 500; */
    padding: .375rem .75rem;
    border-radius: .25rem;
}

.refresh-btn:hover {
    background-color: var(--primary-dark);
    color: var(--text-light);
}

.refresh-btn:active {
    background-color: var(--primary-dark);
}

#lastSyncTime {
    font-size: 0.75rem;
    color: #6c757d;
}

/* ==================== BUTTONS ==================== */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-primary:focus,
.btn-primary:active {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* ==================== FORMS ==================== */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(41, 68, 74, 0.25);
}

/* ==================== CARDS ==================== */
.card {
    border: none;
    border-radius: 8px;
}

/* ==================== LOGIN PAGE ==================== */
#login-container .card {
    border-radius: 12px;
}

/* ==================== MODALS ==================== */
.custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    align-items: center;
    justify-content: center;
}

.custom-modal.active {
    display: flex;
}

.custom-modal-content {
    background-color: white;
    border-radius: 8px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 1100;
    align-items: center;
    justify-content: center;
}

.modal-loader.active {
    display: flex;
}

/* ==================== CAMERA MODAL ==================== */
#camera-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1100;
}

#camera-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

#camera-modal .modal-content {
    background: white;
    border-radius: 8px;
    max-width: 95%;
    max-height: 90%;
    overflow: hidden;
}

#camera-modal .modal-header {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#camera-modal .modal-body {
    padding: 12px;
}

#camera-view {
    width: 100%;
    max-height: 60vh;
    object-fit: cover;
    border-radius: 4px;
}

.camera-controls {
    margin-top: 12px;
    text-align: center;
}

/* ==================== PHOTO GALLERY ==================== */
.cursor-pointer {
    cursor: pointer;
}

.cursor-pointer:hover {
    opacity: 0.8;
    transition: all 0.2s ease;
}

#photoGallery .img-thumbnail,
#existingAttachments .img-thumbnail {
    cursor: pointer;
    transition: all 0.2s ease;
}

#photoGallery .img-thumbnail:hover,
#existingAttachments .img-thumbnail:hover {
    opacity: 0.8;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

/* ==================== PERCENTAGE SLIDER ==================== */
.form-range::-webkit-slider-thumb {
    background: var(--primary-color);
}

.form-range::-moz-range-thumb {
    background: var(--primary-color);
}

#percentageValue {
    font-weight: bold;
    color: var(--primary-color);
}

/* ==================== FORM CONTAINER ==================== */
#form-container,
#delay-form-container,
#delay-edit-form-container {
    padding: 12px;
    overflow-y: auto;
    max-height: calc(100vh - 60px);
    padding-bottom: 100px;
}

#form-container .card,
#delay-form-container .card,
#delay-edit-form-container .card {
    margin-bottom: 60px;
}

/* ==================== DELAY LIST CONTAINER ==================== */
#delay-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    background-color: var(--bg-light);
}

#delay-list-footer {
    flex-shrink: 0;
    padding: 8px 12px 12px;
    background-color: var(--bg-light);
    border-top: 1px solid #dee2e6;
}

/* ==================== DELAY PHOTO GALLERY ==================== */
#delayPhotoGallery .img-thumbnail,
#delayExistingAttachments .img-thumbnail {
    cursor: pointer;
    transition: all 0.2s ease;
}

#delayPhotoGallery .img-thumbnail:hover,
#delayExistingAttachments .img-thumbnail:hover {
    opacity: 0.8;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 576px) {
    .main-header .navbar-brand {
        font-size: 0.9rem;
    }
    
    .filter-section .form-select {
        font-size: 0.8rem;
    }
    
    .activity-card {
        padding: 8px 10px;
    }
    
    .activity-card .activity-id {
        font-size: 0.85rem;
    }
    
    .activity-card .activity-name {
        font-size: 0.8rem;
    }
    
    .activity-card .activity-details {
        font-size: 0.75rem;
    }
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    color: #adb5bd;
}

/* ==================== NAVBAR COLLAPSE ==================== */
.navbar-collapse {
    background-color: var(--primary-color);
}

.navbar-collapse .nav-link {
    color: var(--text-light) !important;
    padding: 10px 15px;
}

.navbar-collapse .nav-link:hover {
    background-color: var(--primary-dark);
}

