/* Finance Vault — Complementary Styles */
/* This file provides base styles and print optimizations */

/* Base Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Prevent iOS Safari auto-zoom on input focus */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 20px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

/* Print Styles */
@page {
    size: landscape;
    margin: 10mm;
}

@media print {
    html, body {
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        overflow: visible !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .no-print,
    .admin-panel,
    #toastContainer {
        display: none !important;
    }

    .app-container {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .sticky {
        position: static !important;
    }

    .section-card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        break-inside: avoid;
        page-break-inside: avoid;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .cell-input {
        border: none !important;
        padding: 2px 4px !important;
        box-shadow: none !important;
        font-size: 10pt !important;
    }

    .cell-input:not(.has-cell-color) {
        background: transparent !important;
    }

    .cell-input.has-cell-color {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .drag-handle,
    .delete-btn,
    .action-cell,
    .remove-col-btn,
    .table-actions {
        display: none !important;
    }

    .overflow-x-auto {
        overflow: visible !important;
    }

    .editable-table {
        border: 1px solid #000 !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .editable-table th,
    .editable-table td {
        border: 1px solid #999 !important;
        padding: 4px 6px !important;
        white-space: normal !important;
        word-break: break-word !important;
    }

    .editable-table th {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Hide drag handle column and action column */
    .editable-table th:first-child,
    .editable-table td:first-child,
    .editable-table th:last-child,
    .editable-table td:last-child {
        display: none !important;
    }

    .fade-in-up {
        animation: none !important;
        opacity: 1 !important;
    }
}

/* Focus Visible — Accessibility */
:focus-visible {
    outline: 2px solid #3373ff;
    outline-offset: 2px;
}

.cell-input:focus-visible {
    outline: none;
}

/* Touch Target Minimum — Mobile Accessibility */
@media (pointer: coarse) {
    .btn,
    .admin-tab,
    .tab-btn-auth,
    .delete-btn,
    .remove-col-btn,
    .remove-colleague,
    button {
        min-height: 44px;
    }
}

/* Prevent text selection on interactive elements */
.drag-handle,
.delete-btn,
.remove-col-btn {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Smooth scrolling */
#activityLogContainer {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Horizontal scroll for tables — optimized for touch */
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    position: relative;
    will-change: scroll-position;
}

/* Prevent whole-page horizontal scroll */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Ensure app container and sections never cause horizontal overflow */
.app-container {
    overflow-x: hidden;
    max-width: 100vw;
}

.section-card {
    max-width: 100%;
    overflow: hidden;
}

/* Ensure top bar never overflows on mobile */
.sticky {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Ensure admin panel respects viewport */
.admin-panel {
    max-width: calc(100vw - 16px);
    overflow-x: auto;
}

/* Fix permission table on small screens */
#permTable {
    min-width: 600px;
}

/* Ensure footer stays contained */
footer, [class*="border-t"] {
    max-width: 100vw;
    overflow: hidden;
}