/**
 * Language Toggle - Clean Simple Design
 */

/* Language Toggle - Pill Style */
.lang-toggle {
    display: inline-flex;
    align-items: center;
    background: var(--bg-secondary, #f1f5f9);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.lang-toggle .lang-opt {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #64748b);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.lang-toggle .lang-opt:hover {
    color: var(--text-primary, #1e293b);
    background: var(--bg-hover, rgba(0,0,0,0.05));
}

.lang-toggle .lang-opt.active {
    background: var(--primary, #3b82f6);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Dark mode */
[data-theme="dark"] .lang-toggle {
    background: var(--bg-secondary, rgba(255,255,255,0.08));
    border-color: var(--border-color, rgba(255,255,255,0.1));
}

[data-theme="dark"] .lang-toggle .lang-opt {
    color: var(--text-secondary, #94a3b8);
}

[data-theme="dark"] .lang-toggle .lang-opt:hover {
    color: var(--text-primary, #f1f5f9);
    background: rgba(255,255,255,0.1);
}

[data-theme="dark"] .lang-toggle .lang-opt.active {
    background: var(--primary, #3b82f6);
    color: white;
}

/**
 * Enhanced Mobile Responsive Styles
 */

/* Mobile Navigation */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 1001;
        transition: left 0.3s ease;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .mobile-menu-btn {
        display: flex !important;
    }
}

/* Mobile Header */
@media (max-width: 768px) {
    .top-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .page-title {
        font-size: 1.125rem !important;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .header-actions {
        gap: 0.5rem;
    }
    
    .header-search {
        display: none;
    }
    
    /* Show search on separate row when focused */
    .header-search.mobile-expanded {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        padding: 0.75rem 1rem;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
    }
    
    .header-search.mobile-expanded input {
        width: 100%;
    }
    
    /* Mobile Search Toggle */
    .mobile-search-toggle {
        display: flex !important;
    }
    
    .theme-toggle,
    .lang-switcher .lang-btn {
        padding: 0.5rem;
    }
    
    .lang-switcher .lang-code,
    .lang-switcher .lang-btn i.fa-chevron-down {
        display: none;
    }
}

/* Mobile Cards & Content */
@media (max-width: 768px) {
    .card {
        border-radius: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Stack grid layouts */
    .grid-2,
    .grid-3,
    .grid-4,
    .info-grid,
    .stat-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Mobile Stats */
    .stats-row,
    .quick-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-card .stat-label {
        font-size: 0.75rem;
    }
}

/* Mobile Tables - Responsive */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Card-style tables on mobile */
    .table-mobile-cards thead {
        display: none;
    }
    
    .table-mobile-cards tbody tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 0.5rem;
        margin-bottom: 0.75rem;
        padding: 1rem;
    }
    
    .table-mobile-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .table-mobile-cards tbody td:last-child {
        border-bottom: none;
    }
    
    .table-mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        text-transform: uppercase;
        color: var(--text-secondary);
    }
    
    /* Priority table columns */
    .table-mobile-cards td.priority-col,
    .table-mobile-cards td.actions-col {
        justify-content: flex-start;
    }
}

/* Mobile Forms */
@media (max-width: 768px) {
    .form-row,
    .form-group-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-group {
        width: 100%;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 0.75rem;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    /* Form Actions - Stack buttons */
    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile Modals */
@media (max-width: 768px) {
    .modal-content,
    .modal-dialog {
        margin: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .modal-body {
        padding: 1rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        background: var(--bg-card);
        z-index: 10;
    }
    
    .modal-footer {
        padding: 1rem;
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* Mobile Dropdowns */
@media (max-width: 768px) {
    .dropdown-menu {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        transform: none !important;
        border-radius: 1rem 1rem 0 0;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .dropdown-menu::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--border-color);
        border-radius: 2px;
        margin: 0.75rem auto;
    }
}

/* Mobile Notifications */
@media (max-width: 768px) {
    .notification-dropdown {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 70vh;
        border-radius: 1rem 1rem 0 0;
    }
}

/* Mobile Pagination */
@media (max-width: 768px) {
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .pagination .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .pagination .page-info {
        width: 100%;
        text-align: center;
        order: -1;
        margin-bottom: 0.5rem;
    }
}

/* Mobile Tabs */
@media (max-width: 768px) {
    .tabs,
    .nav-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
    }
    
    .tab,
    .nav-tab {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

/* Mobile Specific - Ticket Details */
@media (max-width: 768px) {
    .ticket-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .ticket-meta {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        width: 100%;
    }
    
    .ticket-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .ticket-actions .btn {
        width: 100%;
        justify-content: center;
        font-size: 0.875rem;
    }
    
    .reply-box {
        padding: 0.75rem;
    }
    
    .reply-content {
        font-size: 0.9375rem;
    }
}

/* Mobile Dashboard */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .widget {
        padding: 1rem;
    }
}

/* Mobile Kanban */
@media (max-width: 768px) {
    .kanban-board {
        flex-direction: column;
    }
    
    .kanban-column {
        width: 100%;
        min-width: auto;
    }
}

/* Touch-Friendly Interactions */
@media (max-width: 768px) {
    /* Larger tap targets */
    .btn,
    button,
    a.btn,
    .dropdown-item,
    .nav-item,
    .list-item {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Better spacing for touch */
    .action-buttons .btn,
    .btn-group .btn {
        margin: 0.25rem;
    }
    
    /* Swipeable cards */
    .card.swipeable {
        touch-action: pan-x;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .top-header,
    .mobile-menu-btn,
    .notification-bell,
    .theme-toggle,
    .lang-switcher,
    .btn-group,
    .no-print,
    footer {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* Dark Mode Adjustments */
[data-theme="dark"] .lang-dropdown {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .lang-dropdown .lang-option {
    color: var(--text-primary);
}

[data-theme="dark"] .lang-dropdown .lang-option:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .lang-dropdown .lang-option.active {
    background: rgba(59, 130, 246, 0.2);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Safe Area Support for Modern Devices */
@supports (padding: env(safe-area-inset-bottom)) {
    .main-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .modal-footer,
    .bottom-bar,
    .mobile-nav {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}
