/* ============================================================================
   EMPLOYEE ONBOARDING SYSTEM - MOBILE STYLES
   ============================================================================ */

/* ============================================================================
   TABLET (768px and below)
   ============================================================================ */

@media (max-width: 768px) {
    /* Header */
    header {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    header h1 {
        font-size: 18px;
        margin-bottom: 5px;
    }

    .user-info {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .user-info span {
        width: 100%;
        text-align: center;
        margin-bottom: 8px;
    }

    /* Navigation */
    nav {
        padding: 0;
        justify-content: center;
    }

    nav a {
        padding: 12px 15px;
        font-size: 13px;
    }

    /* Container */
    .container {
        padding: 15px;
    }

    /* Cards */
    .card {
        padding: 20px 15px;
        border-radius: 8px;
    }

    .card h2 {
        font-size: 18px;
    }

    /* Stats */
    .stats {
        gap: 10px;
    }

    .stat-box {
        min-width: calc(50% - 5px);
        padding: 15px 10px;
    }

    .stat-box h3 {
        font-size: 10px;
    }

    .stat-box .number {
        font-size: 24px;
    }

    /* Forms */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row .form-group {
        min-width: 100%;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Tables to Cards */
    .table-wrapper {
        display: none;
    }

    .mobile-cards {
        display: block;
    }

    /* Buttons */
    .btn-lg {
        width: 100%;
        padding: 16px;
    }

    .btn-sm {
        padding: 8px 12px;
    }

    /* Info Grid */
    .info-grid,
    .documents-grid {
        grid-template-columns: 1fr;
    }

    /* Alerts */
    .alert {
        padding: 12px 15px;
        font-size: 13px;
    }

    /* Progress Card */
    .progress-card {
        padding: 20px 15px;
    }

    /* Login */
    .login-card {
        padding: 30px 20px;
        margin: 10px;
    }

    /* Invite Card (Dashboard) */
    .invite-card {
        padding: 20px 15px;
    }

    .invite-form .form-row {
        flex-direction: column;
    }

    .invite-form .form-group {
        min-width: 100%;
    }

    .invite-form .btn-primary {
        width: 100%;
        margin-top: 10px;
    }

    /* View Employee Page */
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-info {
        text-align: center;
    }

    .info-section {
        grid-template-columns: 1fr;
    }

    .info-box {
        padding: 12px;
    }

    /* Task Items */
    .task-item {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .task-label {
        min-width: 100%;
    }

    /* File Items */
    .file-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .file-item .btn {
        width: 100%;
        text-align: center;
    }

    /* Section Dividers */
    .section-divider {
        margin: 20px 0 15px 0;
        padding-top: 15px;
    }

    .section-divider h3 {
        font-size: 16px;
    }

    /* Error Viewer */
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .toolbar > div:last-child {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .toolbar .btn {
        width: 100%;
    }

    .error-entry {
        font-size: 11px;
        padding: 12px;
    }

    /* Keypad (Login) */
    .keypad-card {
        padding: 30px 20px;
        margin: 10px;
    }

    .keypad-card h1 {
        font-size: 20px;
    }

    .keypad {
        max-width: 220px;
    }

    .key {
        width: 65px;
        height: 65px;
        font-size: 24px;
    }

    /* Mini Progress */
    .mini-progress {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .mini-progress-bar {
        width: 100%;
    }
}

/* ============================================================================
   SMALL MOBILE (480px and below)
   ============================================================================ */

@media (max-width: 480px) {
    /* Header */
    header h1 {
        font-size: 16px;
    }

    /* Stats - Stack vertically */
    .stats {
        flex-direction: column;
    }

    .stat-box {
        min-width: 100%;
    }

    /* Card Actions */
    .employee-card-actions {
        flex-direction: column;
    }

    .employee-card-actions .btn {
        width: 100%;
    }

    /* Navigation - Scroll horizontal */
    nav {
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }

    nav a {
        padding: 12px 12px;
        font-size: 12px;
    }

    /* Keypad smaller */
    .keypad {
        max-width: 200px;
        gap: 10px;
    }

    .key {
        width: 58px;
        height: 58px;
        font-size: 22px;
    }

    .pin-display {
        gap: 10px;
    }

    .pin-dot {
        width: 16px;
        height: 16px;
    }

    /* Public Header (Employee Form) */
    .public-header {
        padding: 25px 15px;
    }

    .public-header h1 {
        font-size: 22px;
    }

    .public-header p {
        font-size: 14px;
    }

    /* Form Submit Button */
    .form-actions {
        margin-top: 20px;
        padding-top: 15px;
    }

    /* Success Message */
    .success-message {
        padding: 40px 15px;
    }

    .success-message .icon {
        font-size: 60px;
    }

    .success-message h2 {
        font-size: 20px;
    }
}

/* ============================================================================
   TOUCH DEVICE IMPROVEMENTS
   ============================================================================ */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }

    .btn-sm {
        min-height: 36px;
        padding: 8px 14px;
    }

    nav a {
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    .checkbox-item {
        min-height: 48px;
    }

    .key {
        min-height: 60px;
        min-width: 60px;
    }

    /* Remove hover effects that don't work on touch */
    .key:hover {
        background: #f5f5f5;
    }

    .key:active {
        background: #667eea;
        color: white;
    }

    tbody tr:hover {
        background: transparent;
    }
}

/* ============================================================================
   LANDSCAPE PHONE
   ============================================================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .login-page {
        padding: 10px;
    }

    .keypad-card {
        padding: 15px;
    }

    .keypad-card h1 {
        font-size: 18px;
        margin-bottom: 3px;
    }

    .keypad-card .subtitle {
        margin-bottom: 10px;
        font-size: 12px;
    }

    .pin-display {
        margin-bottom: 10px;
    }

    .pin-dot {
        width: 14px;
        height: 14px;
    }

    .keypad {
        gap: 8px;
    }

    .key {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .lockout-timer {
        padding: 8px;
        margin-bottom: 10px;
    }

    .lockout-timer .countdown {
        font-size: 18px;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    header, nav, .btn, .form-actions, .employee-card-actions {
        display: none !important;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .table-wrapper {
        display: block !important;
        overflow: visible;
    }

    .mobile-cards {
        display: none !important;
    }

    table {
        min-width: auto;
    }
}

/* ============================================================================
   ADDRESS AUTOCOMPLETE MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    .address-display {
        padding: 10px;
        font-size: 14px;
    }

    .address-display .change-link {
        display: block;
        margin-top: 10px;
        padding: 8px;
        background: #667eea;
        color: white;
        text-align: center;
        border-radius: 5px;
    }

    /* Canada Post dropdown fixes */
    .pca .pcaautocomplete {
        max-width: calc(100vw - 30px) !important;
        left: 15px !important;
        right: 15px !important;
    }
}
