:root {
    --primary-color: #d62828;
    --primary-hover: #b71c1c;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 1400px;
    border-radius: 20px;
    padding: 40px 50px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ========================
   HEADER
======================== */
header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    padding: 10px 0;
}

.logo-left {
    position: absolute;
    top: -10px;
    left: -10px;
}

.logo-right {
    position: absolute;
    top: -10px;
    right: -10px;
}

.app-logo {
    max-height: 100px;
    width: auto;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: block;
}

.logo-left a,
.logo-right a {
    text-decoration: none;
    display: block;
}

.logo-left a:hover .app-logo,
.logo-right a:hover .app-logo {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
}

h1 {
    font-weight: 700;
    font-size: 2rem;
    color: #111827;
    margin-bottom: 10px;
    padding-top: 110px;
}

/* ========================
   METADATA
======================== */
.metadata-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.metadata-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metadata-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.modern-input {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background-color: white;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    font-family: inherit;
}

.modern-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(214, 40, 40, 0.12);
}

.modern-select {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background-color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
    outline: none;
    width: 100%;
    font-family: inherit;
}

.modern-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(214, 40, 40, 0.12);
}

/* ========================
   SECTION TABS
======================== */
.section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.section-tab {
    padding: 9px 18px;
    border: 2px solid var(--tab-color, #ccc);
    border-radius: 8px;
    background: white;
    color: #374151;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.section-tab:hover {
    background: var(--tab-color, #ccc);
    color: white;
    transform: translateY(-1px);
}

.section-tab.active {
    background: var(--tab-color, #ccc);
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* ========================
   SECTION FORM PANEL
======================== */
.section-form-panel {
    background: white;
    border-radius: 14px;
    border: 2px solid #e5e7eb;
    padding: 24px;
    margin-bottom: 24px;
    transition: border-color 0.3s;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Materiał / Kategoria — szersze pole (2 kolumny) */
.form-group-wide {
    grid-column: span 2;
}

/* Pole z jedną opcją (Pochodzenie, Rodzaj opłaty) — edytowalne, subtelnie wyróżnione */
.select-readonly {
    background-color: #f9fafb;
    color: #374151;
    border-style: dashed;
}

.number-input {
    text-align: right;
}

/* ========================
   FORM ACTIONS
======================== */
.form-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.primary-btn {
    padding: 12px 28px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(214, 40, 40, 0.3);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgba(214, 40, 40, 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    padding: 12px 20px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.small-btn {
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.danger-btn {
    padding: 12px;
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid #fecaca;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
}

.danger-btn:hover {
    background: #ef4444;
    color: white;
}

/* ========================
   REPORT TABLE
======================== */
.report-section {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.report-header h3 {
    font-size: 1rem;
    color: var(--text-muted);
}

.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
}

#report-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

#report-table th {
    text-align: left;
    padding: 12px;
    background: #f9fafb;
    border-bottom: 2px solid #eee;
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.truncated-th {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

#report-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.875rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

tbody tr:hover {
    background-color: #f8fafc;
}

.text-right {
    text-align: right !important;
}

.download-btn {
    width: 100%;
    padding: 15px;
    background: #059669;
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.download-btn:hover {
    background: #047857;
}

/* ========================
   BOTTOM ACTIONS
======================== */
.report-actions-bottom {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

.upload-btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    cursor: pointer;
    border-radius: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.3s ease;
}

/* ========================
   ADMIN ICONS
======================== */
.admin-icons-corner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    z-index: 1000;
}

.admin-icons-row {
    display: flex;
    gap: 10px;
}

.icon-btn-small {
    width: 36px;
    height: 36px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    color: var(--text-main);
    padding: 0;
}

.icon-btn-small:hover {
    transform: scale(1.1);
    background: #f3f4f6;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.file-info-text {
    font-size: 0.68rem;
    color: var(--text-muted);
    max-width: 200px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    align-self: center;
    opacity: 0.8;
}

/* ========================
   FOOTER
======================== */
footer {
    margin-top: 40px;
    text-align: center;
    font-size: 0.8rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 20px;
    color: var(--text-muted);
}

/* ========================
   MISC
======================== */
.hidden {
    display: none !important;
}

p {
    color: var(--text-muted);
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: none;
}

/* ========================
   RESPONSIVE
======================== */
@media (max-width: 900px) {
    .metadata-grid {
        grid-template-columns: 1fr 1fr;
    }
    .container {
        padding: 24px 20px;
    }
}

@media (max-width: 600px) {
    .metadata-grid {
        grid-template-columns: 1fr;
    }
    h1 {
        font-size: 1.4rem;
        padding-top: 80px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .section-tabs {
        gap: 6px;
    }
    .section-tab {
        padding: 7px 12px;
        font-size: 0.78rem;
    }
}
