/* ===== MAIN STYLESHEET ===== */

/* ===== FONT DEFINITIONS ===== */
@font-face {
    font-family: 'Inter';
    src: url('/fonts/Inter.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* ===== ROOT VARIABLES ===== */
:root {
    --primary: #c2410c;
    --primary-dark: #9a3412;
    --primary-light: #ea580c;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --border: #E5E7EB;
}

/* ===== DARK THEME VARIABLES ===== */
.dark {
    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --bg-primary: #111827;
    --bg-secondary: #1F2937;
    --border: #374151;
}

/* ===== BASE STYLES ===== */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

.container {
    width: 95%;
    max-width: 1200px;
    margin: auto;
    padding: 10px;
}

/* ===== DARK MODE OVERRIDES ===== */
.dark body {
    background: linear-gradient(to bottom, #111827, #1F2937);
}

.dark .bg-white {
    background-color: #1F2937;
}

.dark .text-gray-900 {
    color: #F9FAFB;
}

.dark .text-gray-700 {
    color: #D1D5DB;
}

.dark .text-gray-500 {
    color: #9CA3AF;
}

.dark .border-gray-200 {
    border-color: #374151;
}

.dark input,
.dark select,
.dark textarea {
    background-color: #374151;
    border-color: #4B5563;
    color: #F9FAFB;
}

.dark input::placeholder {
    color: #9CA3AF;
}

/* ===== REPORTING CARD OVERRIDES (ensure dark mode works without Tailwind dark variant) ===== */
.report-card {
    border-radius: 1rem;
    background: white;
    border: 1px solid #e5e7eb;
}

.report-card-header {
    /* light gradient */
    background: linear-gradient(to right, #fef3c7, #ffedd5) !important;
    color: #111827;
}

.dark .report-card {
    background-color: #374151 !important;
    border-color: #4B5563 !important;
}

.dark .report-card-header {
    /* stronger gradient for dark mode */
    background: linear-gradient(to right, #1f2937, #374151) !important;
    color: #ffffff !important;
}

/* Better form field contrast in dark mode */
.dark input[type="text"],
.dark input[type="email"], 
.dark select,
.dark textarea {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
    color: #f9fafb !important;
}

.dark input[type="text"]:focus,
.dark input[type="email"]:focus,
.dark select:focus,
.dark textarea:focus {
    background-color: #1f2937 !important;
    border-color: #4f46e5 !important;
    color: #f9fafb !important;
}

.dark input::placeholder,
.dark textarea::placeholder {
    color: #9ca3af !important;
}

/* File input styling for dark mode */
.dark input[type="file"] {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
    color: #f9fafb !important;
}

/* Ensure labels are visible in dark mode */
.dark label {
    color: #d1d5db !important;
}

/* Force desktop form visibility */
@media (min-width: 1024px) {
    .desktop-form {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .desktop-form .report-card {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Ensure proper footer styling in dark mode */
.dark footer {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}

.dark footer p {
    color: #f9fafb !important;
}

/* Additional dark mode improvements */
.dark .text-gray-500 {
    color: #9ca3af !important;
}

.dark .text-gray-600 {
    color: #9ca3af !important;
}

.dark .text-gray-700 {
    color: #d1d5db !important;
}

/* Ensure buttons have proper contrast in dark mode */
.dark .btn-primary {
    background-color: #c2410c !important;
    color: #ffffff !important;
}

.dark .btn-primary:hover {
    background-color: #9a3412 !important;
}

/* Ensure file input button is visible in dark mode */
.dark input[type="file"]::-webkit-file-upload-button {
    background-color: #374151 !important;
    color: #d1d5db !important;
    border: 1px solid #4b5563 !important;
}

.dark input[type="file"]::file-selector-button {
    background-color: #374151 !important;
    color: #d1d5db !important;
    border: 1px solid #4b5563 !important;
}

.dark .hover\:bg-gray-50:hover {
    background-color: #374151;
}

.dark thead {
    background-color: #374151;
}

/* ===== HEADER STYLES ===== */
header {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

header .container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

header h1 {
    margin: 0 0 10px 0;
    font-size: 1.875rem;
    font-weight: 700;
}

/* ===== BUTTON STYLES ===== */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* ===== TABLE STYLES ===== */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
}

table thead {
    background-color: var(--bg-secondary);
}

table thead th {
    position: sticky;
    top: 0;
    background-color: var(--bg-secondary);
    z-index: 2;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

table tbody tr {
    transition: background-color 0.2s ease;
    cursor: pointer;
}

table tbody tr:hover {
    background-color: var(--bg-secondary);
}

/* ===== FORM STYLES ===== */
form {
    margin: 20px 0;
}

input[type="text"], 
input[type="date"], 
input[type="submit"],
select {
    width: 100%;
    padding: 0.75rem;
    margin: 5px 0;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

input[type="submit"] {
    background-color: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-weight: 500;
}

input[type="submit"]:hover {
    background-color: var(--primary-dark);
}

/* ===== SEARCH HIGHLIGHT ===== */
.search-highlight {
    background-color: #fde68a;
    padding: 0.1em 0.2em;
    border-radius: 0.2em;
}

/* ===== CARD VIEW STYLES (dla przyszłego kafelkowego widoku) ===== */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
}

.card {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.card h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-weight: 600;
}

.card p {
    margin: 0.25rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ===== PAGINATION STYLES ===== */
.pagination-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    gap: 0.5rem;
}

.pagination-item {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.pagination-item:hover,
.pagination-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 640px) {
    .container {
        width: 95%;
        padding: 0.5rem;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    table th, 
    table td {
        padding: 0.5rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .card-container {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
}

@media (min-width: 768px) {
    header .container {
        flex-direction: row;
        justify-content: space-between;
    }

    header h1 {
        margin: 0;
    }

    input[type="text"], 
    input[type="date"], 
    input[type="submit"],
    select {
        width: auto;
    }
}

@media (min-width: 1024px) {
    .container {
        width: 90%;
    }
}

/* ===== UTILITY CLASSES ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.space-x-4 > * + * {
    margin-left: 1rem;
}