/**
 * JTC TMIS Portal - Responsive Styles
 * Mobile and tablet optimizations
 */

/* ========================================
   TABLET (768px - 1024px)
   ======================================== */
@media (max-width: 1024px) {
    .content-wrapper {
        padding: var(--spacing-md);
    }
    
    .content-area {
        padding: var(--spacing-md);
    }
}

/* ========================================
   MOBILE (< 768px)
   ======================================== */
@media (max-width: 768px) {
    
    /* Header */
    .top-header {
        padding: 0 var(--spacing-md);
    }
    
    .logo-text h1 {
        font-size: 0.875rem;
    }
    
    .logo-text p {
        display: none;
    }
    
    .logo {
        height: 32px;
    }
    
    .header-right {
        gap: var(--spacing-sm);
    }
    
    /* Hide user info text on mobile */
    .user-info {
        display: none;
    }
    
    .user-profile i.fa-chevron-down {
        display: none;
    }
    
    /* Sidebar - becomes overlay */
    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        z-index: var(--z-fixed);
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* Backdrop for mobile sidebar */
    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--z-fixed) - 1);
        animation: fadeIn var(--transition-base);
    }
    
    /* Main content takes full width on mobile */
    .main-content {
        width: 100%;
    }
    
    /* Breadcrumb */
    .breadcrumb-container {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .breadcrumb {
        font-size: 0.75rem;
    }
    
    /* Content wrapper */
    .content-wrapper {
        padding: var(--spacing-md);
    }
    
    .content-area {
        padding: var(--spacing-md);
        border-radius: var(--border-radius-sm);
    }
    
    /* Buttons */
    .btn {
        font-size: 0.875rem;
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    /* Modals */
    .modal-container {
        width: 95%;
        max-height: 85vh;
    }
    
    .modal-small,
    .modal-medium,
    .modal-large,
    .modal-full {
        width: 95%;
        max-width: none;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--spacing-md);
    }
    
    /* Toast notifications */
    .toast-container {
        left: var(--spacing-sm);
        right: var(--spacing-sm);
        max-width: none;
    }
    
    /* Step indicator */
    .step-indicator {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .step-indicator-item {
        flex-direction: row;
        width: 100%;
        justify-content: flex-start;
        gap: var(--spacing-md);
    }
    
    .step-indicator-item:not(:last-child)::after {
        display: none;
    }
    
    .step-indicator-item::before {
        content: '';
        position: absolute;
        left: 20px;
        top: 50px;
        width: 2px;
        height: calc(100% + var(--spacing-sm));
        background-color: var(--border-color);
    }
    
    .step-indicator-item:last-child::before {
        display: none;
    }
    
    .step-indicator-item.completed::before {
        background-color: var(--color-success);
    }
    
    .step-label {
        text-align: left;
    }
    
    /* Step navigation */
    .step-navigation {
        flex-direction: column;
    }
    
    .step-btn-prev,
    .step-btn-next {
        width: 100%;
        min-width: auto;
    }
    
    /* Cards */
    .card-header,
    .card-body,
    .card-footer {
        padding: var(--spacing-md);
    }
    
    /* Confirm dialog */
    .confirm-box {
        width: 95%;
        padding: var(--spacing-lg);
    }
    
    .confirm-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .confirm-buttons button {
        width: 100%;
    }
    
    /* User dropdown */
    .user-dropdown {
        right: var(--spacing-md);
        min-width: 180px;
    }
}

/* ========================================
   SMALL MOBILE (< 480px)
   ======================================== */
@media (max-width: 480px) {
    
    /* Typography */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }
    h4 { font-size: 1rem; }
    
    /* Header */
    .menu-toggle {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .logo-text h1 {
        font-size: 0.75rem;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
    }
    
    .notification-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    /* Sidebar */
    .sidebar {
        width: 80%;
        max-width: 280px;
    }
    
    .nav-item {
        padding: var(--spacing-sm);
    }
    
    /* Content */
    .content-wrapper {
        padding: var(--spacing-sm);
    }
    
    .content-area {
        padding: var(--spacing-sm);
    }
    
    /* Buttons */
    .btn-sm {
        padding: 4px 8px;
        font-size: 0.6875rem;
    }
    
    /* Modals */
    .modal-container {
        width: 100%;
        border-radius: 0;
        max-height: 100vh;
        top: 0;
        left: 0;
        transform: none;
    }
    
    .modal-header h3 {
        font-size: 1rem;
    }
    
    /* Toast */
    .toast-container {
        top: var(--spacing-sm);
        left: var(--spacing-sm);
        right: var(--spacing-sm);
    }
    
    .toast {
        padding: var(--spacing-sm);
    }
    
    .toast-message {
        font-size: 0.75rem;
    }
    
    /* Step indicator */
    .step-number {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
    
    .step-label {
        font-size: 0.6875rem;
    }
}

/* ========================================
   LANDSCAPE MODE (Mobile)
   ======================================== */
@media (max-height: 500px) and (orientation: landscape) {
    
    .sidebar {
        width: 200px;
    }
    
    .modal-container {
        max-height: 95vh;
    }
    
    .content-loading {
        min-height: 200px;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    
    /* Increase touch targets */
    .btn {
        min-height: 44px;
        padding: var(--spacing-md) var(--spacing-lg);
    }
    
    .nav-item {
        min-height: 44px;
        padding: var(--spacing-md);
    }
    
    .menu-toggle,
    .notification-icon,
    .modal-close,
    .toast-close {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Remove hover effects */
    .btn:hover,
    .nav-item:hover,
    .menu-toggle:hover {
        transform: none;
    }
    
    /* Add active states instead */
    .btn:active {
        transform: scale(0.95);
    }
    
    .nav-item:active {
        background-color: var(--bg-tertiary);
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    
    /* Hide UI elements */
    .top-header,
    .sidebar,
    .breadcrumb-container,
    .step-navigation,
    .modal,
    .toast-container,
    .confirm-dialog {
        display: none !important;
    }
    
    /* Full width content */
    .main-content {
        width: 100%;
    }
    
    .content-area {
        box-shadow: none;
        border: none;
        padding: 0;
    }
    
    /* Adjust colors for print */
    body {
        background: white;
        color: black;
    }
    
    /* Show URLs for links */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   DARK MODE SUPPORT (Optional)
   ======================================== */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles would go here */
    /* Currently disabled - can be enabled in CONFIG */
}

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
    }
    
    .btn {
        border-width: 2px;
    }
    
    .nav-item.active {
        border: 2px solid currentColor;
    }
}
