/* TimeEffect Responsive CSS Framework
 * Phase 1: Mobile Foundation
 * Created: 2025-01-24
 */

/* ========================================
   GENERAL RESPONSIVE IMPROVEMENTS
   ======================================== */

/* Continue button with green play icon */
.continue-button {
    color: #28a745 !important;
    text-decoration: none;
}

.continue-button:hover {
    color: #1e7e34 !important;
}

.play-icon {
    color: #28a745;
    font-size: 14px;
    margin-right: 4px;
}

/* Conservative Mobile Approach - Only modify explicitly marked elements */
/* Preserve TimeEffect's existing table-based layout */

/* Only apply box-sizing to mobile-specific elements */
.mobile-element,
.responsive-element {
    box-sizing: border-box;
}

/* Touch-friendly minimum sizes - only for buttons and form elements */
button, 
input[type="submit"], 
input[type="button"], 
.button,
.mobile-button {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 16px;
    font-size: 16px; /* Prevent zoom on iOS */
}

/* Responsive images - ONLY for explicitly marked content images */
img.content-image,
img.responsive-image {
    max-width: 100%;
    height: auto;
}

/* DO NOT modify default img behavior - preserve TimeEffect layout */
/* TimeEffect uses many 1px spacer images that must not be touched */

/* Responsive tables - ONLY for explicitly marked data tables */
table.data-table,
table.responsive-table {
    width: 100%;
    border-collapse: collapse;
}

/* DO NOT modify default table behavior - preserve TimeEffect layout */

/* ========================================
   IMPROVED FORM ELEMENTS (ALL DEVICES)
   ======================================== */

/* Make input fields and select boxes larger for better usability */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    padding: 8px 12px !important;
    font-size: 16px !important; /* Prevent zoom on iOS */
    min-height: 40px !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
}

/* Larger select boxes */
select {
    min-height: 44px !important;
    padding: 10px 12px !important;
}

/* Login form specific improvements */
.loginForm input[type="text"],
.loginForm input[type="password"],
.loginForm select {
    width: 200px !important;
    min-height: 44px !important;
    padding: 12px 16px !important;
    font-size: 16px !important;
    margin: 4px 0 !important;
}

/* ========================================
   MOBILE STYLES (up to 480px)
   ======================================== */
@media (max-width: 480px) {
    
    
    
    /* Create mobile main options in hamburger menu */
    .mobile-main-options {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        padding: 10px 0 !important;
        border-top: 1px solid #eee !important;
        margin-top: 10px !important;
    }
    
    .mobile-main-options a {
        display: block !important;
        padding: 15px 20px !important;
        text-decoration: none !important;
        color: #333 !important;
        font-size: 16px !important;
        border-bottom: 1px solid #eee !important;
    }
    
    .mobile-main-options a:hover,
    .mobile-main-options a.active {
        background: #f5f5f5 !important;
        color: #007bff !important;
    }
    
    /* Typography */
    body {
        font-size: 16px; /* Minimum readable size */
        line-height: 1.5;
    }
    
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }
    
    /* Layout adjustments */
    .container {
        padding: 10px;
        margin: 0;
    }
    
    /* Navigation */
    .nav-desktop {
        display: none;
    }
    
    .nav-mobile {
        display: block;
    }
    
    /* Forms */
    input[type="text"], 
    input[type="email"], 
    input[type="password"], 
    textarea, 
    select {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
        border: 1px solid #ccc;
        border-radius: 4px;
        margin-bottom: 10px;
    }
    
    /* Tables - Stack on mobile */
    .table-responsive {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .table-stack {
        display: block;
    }
    
    .table-stack thead {
        display: none;
    }
    
    .table-stack tr {
        display: block;
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
    }
    
    .table-stack td {
        display: block;
        text-align: left;
        border: none;
        padding: 5px 0;
    }
    
    .table-stack td:before {
        content: attr(data-label) ": ";
        font-weight: bold;
        display: inline-block;
        width: 120px;
    }
    
    /* Buttons */
    .btn-mobile {
        width: 100%;
        margin-bottom: 10px;
        padding: 15px;
        font-size: 18px;
    }
    
    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile-only elements */
    .mobile-only {
        display: block !important;
    }
}

/* ========================================
   SMALL MOBILE STYLES (up to 320px)
   ======================================== */
@media (max-width: 320px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 5px;
    }
    
    h1 { font-size: 20px; }
    h2 { font-size: 18px; }
    h3 { font-size: 16px; }
    
    button, input[type="submit"], input[type="button"], .button {
        padding: 10px 12px;
        font-size: 14px;
    }
}

/* ========================================
   TABLET STYLES (481px to 768px)
   ======================================== */
@media (min-width: 481px) and (max-width: 768px) {
    body {
        font-size: 16px;
    }
    
    .container {
        padding: 15px;
        max-width: 750px;
        margin: 0 auto;
    }
    
    /* Two-column layout for tablets */
    .col-tablet-2 {
        width: 48%;
        float: left;
        margin-right: 4%;
    }
    
    .col-tablet-2:nth-child(2n) {
        margin-right: 0;
    }
    
    /* Navigation adjustments */
    .nav-mobile {
        display: block;
    }
    
    .nav-desktop {
        display: none;
    }
}

/* ========================================
   DESKTOP STYLES (769px and up)
   ======================================== */
@media (min-width: 769px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 20px;
    }
    
    /* Desktop navigation */
    .nav-mobile {
        display: none;
    }
    
    .nav-desktop {
        display: block;
    }
    
    /* Multi-column layouts */
    .col-desktop-3 {
        width: 31.33%;
        float: left;
        margin-right: 3%;
    }
    
    .col-desktop-3:nth-child(3n) {
        margin-right: 0;
    }
    
    .col-desktop-4 {
        width: 22%;
        float: left;
        margin-right: 4%;
    }
    
    .col-desktop-4:nth-child(4n) {
        margin-right: 0;
    }
    
    /* Hide mobile-only elements */
    .mobile-only {
        display: none !important;
    }
    
    /* Show desktop-only elements */
    .desktop-only {
        display: block !important;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Clearfix */
.clearfix:after {
    content: "";
    display: table;
    clear: both;
}

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Spacing */
.margin-top-10 { margin-top: 10px; }
.margin-bottom-10 { margin-bottom: 10px; }
.padding-10 { padding: 10px; }
.padding-20 { padding: 20px; }

/* Visibility */
.hidden { display: none; }
.visible { display: block; }

/* Touch targets */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-block;
    text-align: center;
    line-height: 44px;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error states */
.error {
    color: #d32f2f;
    border-color: #d32f2f;
}

/* Success states */
.success {
    color: #388e3c;
    border-color: #388e3c;
}

/* ========================================
   MOBILE NAVIGATION
   ======================================== */

.mobile-nav {
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100vh;
    background: #fff;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.mobile-nav.open {
    left: 0;
}

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.mobile-nav-overlay.open {
    display: block;
}

.mobile-nav-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1001;
    background: #007bff;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    font-size: 18px;
    cursor: pointer;
}

.mobile-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav li {
    border-bottom: 1px solid #eee;
}

.mobile-nav a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    font-size: 16px;
}

.mobile-nav a:hover {
    background: #f5f5f5;
}

/* ========================================
   RESPONSIVE FORMS
   ======================================== */

.form-responsive {
    max-width: 100%;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -5px;
}

.form-col {
    flex: 1;
    padding: 0 5px;
    min-width: 0;
}

@media (max-width: 480px) {
    .form-row {
        flex-direction: column;
        margin: 0;
    }
    
    .form-col {
        padding: 0;
        margin-bottom: 10px;
    }
}

/* ========================================
   smaller than 768px
   ======================================== */

.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.table-responsive {
    min-width: 600px;
}

@media (max-width: 768px) {
    
    /* Hide left navigation on mobile - available in hamburger menu */
    #leftNavigation {
        display: none !important;
    }
    
    /* Hide top info with login as on mobile */
    .topInfo {
        display: none !important;
    }
    
    /* Convert main options table to flexbox on mobile */
    #mainOptions {
        display: none !important; /* Hide original table */
    }
    
    /* Hide welcome image on mobile login screen */
    #welcomeImage {
        display: none !important;
    }
    
    /* Hide customer list rows on mobile to save space */
    .customer_list_row {
        display: none !important;
    }
    
    /* Hide logo when hamburger menu is visible */
    #logo {
        display: none !important;
    }
    
    /* Hide hamburger menu on login/start page */
    body.login-page .mobile-nav-toggle,
    body.login-page .mobile-nav,
    body.login-page .mobile-nav-overlay {
        display: none !important;
    }

    .table-responsive {
        min-width: auto;
        font-size: 14px;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 8px 4px;
        white-space: nowrap;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .mobile-nav,
    .mobile-nav-toggle,
    .mobile-nav-overlay,
    .mobile-only {
        display: none !important;
    }
    
    .desktop-only {
        display: block !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
}
