/* Custom fonts */
@font-face {
    font-family: 'SB Liquid';
    src: url('/fonts/SB%20Liquid%20W01%20Solid.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'SBLiquidW01-Solid';
    src: url('/fonts/SB%20Liquid%20W01%20Solid.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'SB Liquid W01 Solid';
    src: url('/fonts/SB%20Liquid%20W01%20Solid.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'M PLUS Rounded 1c';
    src: url('/fonts/MPLUSRounded1c-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'M PLUS Rounded 1c';
    src: url('/fonts/MPLUSRounded1c-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'M PLUS Rounded 1c';
    src: url('/fonts/MPLUSRounded1c-Black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
}

@font-face {
    font-family: 'Roboto';
    src: url('/fonts/Roboto-VariableFont_wdth,wght.ttf') format('truetype-variations');
    font-weight: 100 900;
    font-stretch: 75% 100%;
    font-style: normal;
}

@font-face {
    font-family: 'Roboto Condensed';
    src: url('/fonts/RobotoCondensed-VariableFont_wght.ttf') format('truetype-variations');
    font-weight: 100 900;
    font-style: normal;
}

:root {
    /* Paleta: Pog(R)adajmy Poster Theme (Dark Navy) */
    --bg-body: #1a2634;       /* Głęboki ciemny granat */
    --bg-card: #20323e;       /* Nieco jaśniejszy granat */
    
    --text-main: #ffffff;     /* Czysta biel */
    --text-muted: #8b9bb4;    /* Szaro-niebieski */
    
    --primary: #ffffff;       /* Główny przycisk: Biały */
    --primary-text: #1a2634;  /* Tekst na przycisku */
    
    --accent: #5fa8d3;        /* Tech Blue */
    
    --border-light: #2c4250;  /* Ciemne ramki */
    --input-bg: #15202b;      /* Tło inputów */
    
    --shadow-soft: 0 8px 30px rgba(0,0,0,0.3);
    
    --font-main: 'Montserrat', sans-serif;
    
    --radius: 6px;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-main);
    color: var(--text-main);
    margin: 0 0 1rem 0;
    font-weight: 700;
}

/* Navbar */
nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 2px;
    color: var(--text-main);
    text-transform: uppercase;
}

.logo img {
    max-width: 100%;
    height: auto;
}

.logo span { color: var(--text-muted); }

.links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.burger-menu span {
    width: 100%;
    height: 3px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s;
}

.burger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-btn {
    background: transparent;
    border: none;
    font-family: var(--font-main);
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem 1rem;
    text-transform: uppercase;
    font-size: 0.75rem;
    transition: all 0.2s;
    letter-spacing: 1px;
}

.nav-btn:hover { color: var(--text-main); }
.nav-btn.logout { border: 1px solid var(--border-light); border-radius: 4px; margin-left: 1rem; }

@media (max-width: 768px) {
    .burger-menu {
        display: flex;
    }

    .logo img {
        max-height: 32px;
        width: auto;
    }

    .links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--bg-card);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 80px 0 20px 0;
        transition: right 0.3s ease;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    }

    .links.active {
        right: 0;
    }

    .nav-btn {
        width: 100%;
        text-align: left;
        padding: 1rem 2rem;
        border-radius: 0;
    }

    .nav-btn.logout {
        margin-left: 0;
        margin-top: auto;
        border: none;
        border-top: 1px solid var(--border-light);
    }
}

/* Layout & Utilities */
.container { max-width: 1100px; margin: 3rem auto; padding: 0 1.5rem; }

/* KLUCZOWA POPRAWKA: hidden musi mieć najwyższy priorytet */
.hidden { display: none !important; }

/* Section Headers */
.section-header {
    text-align: left;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
}
.section-header h2 { font-size: 2rem; margin-bottom: 0.2rem; }
.section-header p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    margin-bottom: 2rem;
    border: 1px solid var(--border-light);
}

.card-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin: 0;
}

.card-body { padding: 1.5rem; }

/* Inputs */
.input-group { margin-bottom: 1.5rem; }
.input-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="month"], select, textarea {
    width: 100%;
    padding: 0.9rem;
    background: var(--input-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 0.9rem;
    box-sizing: border-box;
}

/* Month input styling */
input[type="month"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--text-muted);
    background: #111a22;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: var(--primary-text);
    border: none;
    padding: 1rem 2rem;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: transform 0.2s;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(255,255,255,0.1); }

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-light);
    padding: 0.6rem 1.2rem;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: var(--radius);
}
.btn-secondary:hover { border-color: var(--text-main); background: rgba(255,255,255,0.05); }
.btn-small { padding: 0.4rem 0.8rem; font-size: 0.7rem; }
.full-width { width: 100%; }

/* Dashboard Specific */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.highlight-text { font-size: 2.2rem; font-weight: 300; color: var(--text-main); margin: 1rem 0; }
.sub-text { font-size: 0.85rem; color: var(--text-muted); border-top: 1px dashed var(--border-light); padding-top: 1rem; margin-top: 1rem; }
.date-setter { gap: 0.8rem; margin-top: 1.5rem; }

/* Generator Split View */
.split-view { display: grid; grid-template-columns: 320px 1fr; gap: 2rem; }
.split-view.reversed { grid-template-columns: 1fr 320px; }

@media (max-width: 900px) {
    .split-view, .split-view.reversed { grid-template-columns: 1fr; }
    
    .logo img {
        max-width: 100%;
        height: auto;
    }
}

.placeholder-text { color: var(--text-muted); font-style: italic; text-align: center; margin-top: 2rem; }
.divider { border: 0; border-top: 1px dashed var(--border-light); margin: 2rem 0; }

#svg-preview-container {
    background-color: #15202b;
    background-image: linear-gradient(45deg, #1a2634 25%, transparent 25%), linear-gradient(-45deg, #1a2634 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #1a2634 75%), linear-gradient(-45deg, transparent 75%, #1a2634 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}
.empty-state { color: var(--text-muted); }

/* Login */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-body); }
.login-container { background: var(--bg-card); padding: 3rem; width: 100%; max-width: 400px; box-shadow: var(--shadow-soft); border: 1px solid var(--border-light); text-align: center; }
.login-header { margin-bottom: 2.5rem; }
.login-header h1 { font-size: 1.8rem; margin-bottom: 0.5rem; letter-spacing: 3px; }
.login-header p { color: var(--text-muted); font-size: 0.75rem; letter-spacing: 2px; text-transform: uppercase; }

/* Table */
.table-responsive { overflow-x: auto; }
.styled-table { width: 100%; border-collapse: collapse; }
.styled-table th, .styled-table td { padding: 1.2rem; text-align: left; border-bottom: 1px solid var(--border-light); color: var(--text-main); }
.styled-table th { font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted); font-weight: 600; letter-spacing: 1px; }

/* --- MODALE --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Ciemniejsze tło */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { margin: 0; color: var(--text-main); font-size: 1.1rem; }

.close-btn { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.close-btn:hover { color: var(--text-main); }

.modal-body { padding: 2rem; }
.cities-list-scroll { max-height: 400px; overflow-y: auto; padding-right: 10px; }

/* Topic Cards */
.topics-grid {
    display: grid;
    gap: 1rem;
}

.topic-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.topic-card:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.topic-card h4 {
    color: var(--text-main);
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.topic-card p {
    color: var(--text-muted);
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.topic-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.vote-count {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Generator Preview */
#svg-preview-container {
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#svg-preview-container svg {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 3rem;
}

/* Split View */
.split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.split-view.reversed {
    grid-template-columns: 1fr 2fr;
}

@media (max-width: 768px) {
    .split-view,
    .split-view.reversed {
        grid-template-columns: 1fr;
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.highlight-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin: 1rem 0;
}

.sub-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.date-setter {
    margin-top: 1rem;
}

.date-setter > div {
    display: flex;
    gap: 0.5rem;
}

.date-input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 0.75rem;
    color: var(--text-main);
    font-family: var(--font-main);
}

.date-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Sticky Notes */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.sticky-note {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem 1rem 1rem 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.sticky-note:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sticky-note-header {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.75rem;
    padding-right: 60px;
    word-wrap: break-word;
}

.sticky-note-content {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    flex-grow: 1;
    overflow: hidden;
    word-wrap: break-word;
}

.sticky-note-icons {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sticky-note:hover .sticky-note-icons,
.sticky-note-editing .sticky-note-icons {
    opacity: 1;
}

.sticky-note-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    color: #ffffff;
    font-size: 14px;
    transition: background 0.2s ease;
    position: relative;
}

.sticky-note-icon:hover {
    background: rgba(0, 0, 0, 0.4);
}

.sticky-note-icon.info:hover .tooltip {
    display: block;
}

.tooltip {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-body);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
    margin-top: 4px;
    border: 1px solid var(--border);
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 8px;
    border: 6px solid transparent;
    border-bottom-color: var(--border);
}

/* Floating Add Button */
.floating-add-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: var(--primary);
    color: var(--bg-body);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 300;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 100;
}

@media (min-width: 768px) {
    .floating-add-btn {
        position: absolute;
        top: 0;
        right: 0;
        bottom: auto;
    }
}

.floating-add-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.floating-add-btn span {
    line-height: 1;
    margin-top: -2px;
}

/* Sticky Note Edit Mode */
.sticky-note-editing {
    /* Keep original background color */
}

.sticky-note-header-edit {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    padding: 0.25rem 0.35rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    margin-right: 60px;
    width: calc(100% - 60px);
    outline: none;
}

.sticky-note-header-edit:focus {
    border-color: var(--primary);
    border-width: 2px;
    padding: calc(0.25rem - 1px) calc(0.35rem - 1px);
}

.sticky-note-content-edit {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    padding: 0.25rem 0.35rem;
    width: 100%;
    min-height: 80px;
    resize: vertical;
    outline: none;
    line-height: 1.5;
    font-family: 'Montserrat', sans-serif;
}

.sticky-note-content-edit:focus {
    border-color: var(--primary);
    border-width: 2px;
    padding: calc(0.25rem - 1px) calc(0.35rem - 1px);
}

/* Template Upload Form */
.template-upload-form {
    display: flex;
    gap: 1rem;
    align-items: center;
}

@media (max-width: 768px) {
    .template-upload-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .template-upload-form input,
    .template-upload-form button {
        width: 100%;
    }
}

/* Custom File Input */
.file-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.file-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.file-input-label {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: var(--bg-body);
    color: var(--text-main);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    white-space: nowrap;
}

.file-input-label:hover {
    background: var(--bg-card);
    border-color: var(--accent);
}

.file-input-name {
    color: var(--text-muted);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .file-input-wrapper {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    .file-input-label {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    
    .file-input-name {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
}

/* Icon Button */
.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-icon:hover {
    opacity: 1;
}

/* Admin Users Panel - Responsive */
.admin-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.user-card-mobile {
    display: none;
}

@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .admin-header-actions {
        display: flex;
        justify-content: space-between;
        margin-bottom: 1rem;
        order: -1;
    }
    
    .admin-header-actions button {
        flex: 1;
        max-width: 48%;
    }
}

.user-action-btn {
    min-width: 80px;
}

.user-action-btn:not(:last-child) {
    margin-right: 8px;
}

.user-action-delete {
    color: #ff6b6b;
    border-color: #ff6b6b;
}

@media (max-width: 768px) {
    .table-responsive {
        display: none;
    }
    
    .user-card-mobile {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border-light);
        border-radius: var(--radius);
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .user-card-field {
        display: flex;
        flex-direction: column;
        margin-bottom: 0.75rem;
    }
    
    .user-card-label {
        font-size: 0.75rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 0.25rem;
        font-weight: 600;
    }
    
    .user-card-value {
        font-size: 0.95rem;
        color: var(--text-main);
    }
    
    .user-card-actions {
        display: flex;
        justify-content: space-between;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-light);
    }
    
    .user-card-actions button {
        flex: 1;
        max-width: 48%;
    }
}

/* Field History */
.modal-large {
    max-width: 800px;
}

.history-list {
    max-height: 60vh;
    overflow-y: auto;
}

.history-item {
    background: var(--bg-body);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.history-item-value {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 4px;
}

.history-item-value img {
    display: block;
    border-radius: 4px;
}

.history-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Utilities */
.mb-2 {
    margin-bottom: 2rem;
}

.mt-2 {
    margin-top: 2rem;
}

.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}