/* Mobile responsive styles */
@media screen and (max-width: 768px) {
    .main-header {
        height: 56px;
        padding: 0 16px;
    }

    .header-title {
        font-size: 15px;
    }

    .header-subtitle {
        display: none;
    }

    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: 280px;
    }

    .sidebar-header {
        padding: 12px 16px;
        min-height: 52px;
    }

    .sidebar-content {
        padding: 8px 12px 12px;
    }

    .cv-item {
        padding: 12px;
        border-radius: 8px;
    }

    .cv-name {
        font-size: 15px;
    }

    .cv-actions {
        display: flex !important;
        opacity: 1;
    }

    .cv-checkbox {
        width: 22px;
        height: 22px;
    }

    /* Dismiss selection when tapping outside on mobile */
    .mobile-overlay.show {
        pointer-events: auto;
    }

    /* Add padding to sidebar content so last items aren't hidden */
    .sidebar-content {
        padding-bottom: 80px;
    }

    .selection-action-bar.show ~ .main-content {
        padding-bottom: 100px;
    }

    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .mobile-overlay.show {
        display: block;
    }

    /* Selection action bar mobile styles */
    .selection-action-bar {
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
        backdrop-filter: blur(16px);
        background: rgba(255, 255, 255, 0.99);
        padding-bottom: env(safe-area-inset-bottom);
        transform: translateY(100%);
    }

    .selection-action-bar.show {
        transform: translateY(0);
    }

    .action-bar-content {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }

    /* Top row: Counter (centered) */
    .action-bar-counter {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px 0;
        border-bottom: 1px solid #f3f4f6;
    }

    .selection-counter {
        font-size: 16px;
        font-weight: 700;
        color: #f97316;
        letter-spacing: -0.01em;
    }

    /* Bottom row: 3 action buttons */
    .action-bar-actions {
        display: flex;
        align-items: stretch;
        gap: 10px;
        padding: 0;
    }

    .action-bar-actions .btn-action {
        flex: 1;
        min-height: 52px;
        font-size: 15px;
        font-weight: 600;
        padding: 0 12px;
        border-radius: 14px;
        gap: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .action-bar-actions .btn-action svg {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }

    .action-bar-actions .btn-primary {
        min-height: 56px;
        font-size: 16px;
        gap: 10px;
    }

    .action-bar-actions .btn-danger {
        min-height: 52px;
    }

    .action-bar-actions .btn-icon-only span {
        display: none;
    }

    .select-all-btn {
        display: none;
    }

    /* Dimmed main content when selection active */
    .selection-active .main-content {
        pointer-events: none;
    }

    .selection-active #sidebar:not(.mobile-open) {
        filter: brightness(0.94);
    }

    /* Add padding to sidebar content so last items aren't hidden */
    .sidebar-content {
        padding-bottom: 100px;
    }

    /* Swipe gesture hint */
    .selection-action-bar::before {
        content: '';
        position: absolute;
        top: -3px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: #d1d5db;
        border-radius: 3px;
        pointer-events: none;
    }

    .action-bar-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .selection-counter-wrapper {
        flex-shrink: 0;
    }

    .selection-counter {
        font-size: 15px;
        font-weight: 600;
        color: #f97316;
    }

    .action-bar-actions {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .action-bar-actions .btn-action {
        min-height: 44px;
        min-width: 44px;
        padding: 0 12px;
        font-size: 13px;
        border-radius: 10px;
        gap: 4px;
    }

    .action-bar-actions .btn-action svg {
        width: 18px;
        height: 18px;
    }

    .action-bar-actions .btn-primary {
        min-width: auto;
        padding: 0 16px;
        min-height: 48px;
        font-weight: 600;
    }

    .action-bar-actions .btn-icon-only span {
        display: none;
    }

    .select-all-btn {
        display: none;
    }

    /* Add padding to sidebar content so last items aren't hidden */
    .sidebar-content {
        padding-bottom: 80px;
    }

    .selection-action-bar.show + .main-content {
        padding-bottom: 100px;
    }

    /* Panel header mobile styles */
    .panel-header {
        padding: 12px 16px;
        min-height: 52px;
    }

    .panel-title {
        font-size: 14px;
    }

    .actions-container {
        gap: 6px;
    }

    .btn-action {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
    }

    .btn-action svg {
        width: 14px;
        height: 14px;
    }

    .btn-action span {
        display: none;
    }

    .btn-action.btn-primary span,
    .btn-action.btn-danger span {
        display: inline;
    }

    .pagebreak-toggle-wrapper {
        flex-wrap: wrap;
        gap: 8px;
    }

    .pagebreak-warning {
        order: 3;
        width: 100%;
        margin-top: 6px;
    }

    .preview-wrapper {
        padding: 16px;
    }

    #editor {
        padding: 16px;
        font-size: 14px;
    }

    .empty-state {
        padding: 40px 20px;
    }

    .empty-state-icon {
        width: 64px;
        height: 64px;
        margin-bottom: 16px;
    }

    .empty-state-title {
        font-size: 18px;
    }

    .empty-state-description {
        font-size: 14px;
        max-width: 280px;
    }
}

@media screen and (min-width: 769px) {
    .mobile-overlay {
        display: none !important;
    }
}

/* Extra small screens */
@media screen and (max-width: 480px) {
    .lang-switcher {
        transform: scale(0.9);
    }

    .lang-option {
        padding: 5px 10px;
        font-size: 12px;
    }

    .sidebar-toggle {
        width: 36px;
        height: 36px;
    }

    .cv-action-btn {
        width: 32px;
        height: 32px;
    }

    .action-bar-actions {
        gap: 6px;
    }

    .action-bar-actions .btn-action {
        min-height: 44px;
        font-size: 13px;
    }
}

/* Large screens - more breathing room */
@media screen and (min-width: 1200px) {
    .sidebar {
        width: 300px;
    }

    .panel-header {
        padding: 18px 28px;
    }

    #editor {
        padding: 28px;
    }

    .preview-wrapper {
        padding: 40px;
    }
}
