/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* CSS Custom Properties for Light Theme with Red Accents */
:root {
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Harmonious Light Palette */
    --hue: 356; /* Red Hue */
    --background: #f8fafc; /* Very light cool grey */
    --surface: #ffffff;    /* Pure white */
    --surface-hover: #f1f5f9;
    --surface-glass: rgba(255, 255, 255, 0.95);
    
    --primary: hsl(var(--hue), 75%, 53%);       /* Bella Red (#e53e3e) */
    --primary-hover: hsl(var(--hue), 85%, 45%);
    --accent: hsl(var(--hue), 75%, 53%);        
    
    /* Status Colors */
    --status-new: hsl(40, 95%, 48%);      /* Amber for "do weryfikacji" */
    --status-suspicious: hsl(var(--hue), 75%, 53%); /* Red for "podejrzane" */
    --status-ignored: hsl(215, 15%, 50%);  /* Slate for "nieistotne" */
    
    --text-main: #1e293b;   /* Dark slate slate-800 */
    --text-muted: #64748b;  /* Cool grey slate-500 */
    --text-inverse: #ffffff;
    
    --border: #e2e8f0;      /* Light grey border slate-200 */
    --border-glow: hsla(var(--hue), 75%, 53%, 0.15);
    
    --glass-blur: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-smooth);
}

a:hover {
    color: var(--primary-hover);
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--background);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1; /* slate-300 */
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Navigation */
header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-section img {
    height: 42px;
    width: auto;
}

.logo-section h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Red ADMIN badge next to logo */
.logo-section h1::after {
    content: "ADMIN";
    font-size: 0.65rem;
    background-color: var(--primary);
    color: var(--text-inverse);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    vertical-align: middle;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 15px;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 600;
    font-family: var(--font-heading);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.nav-links a:hover, 
.nav-links li.active a {
    color: var(--primary);
    background-color: transparent;
    border-bottom: 2px solid var(--primary);
    border-radius: 0;
}

/* Logout button - white with red border and red text */
.nav-links a.logout-btn {
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background-color: var(--surface);
    transition: var(--transition-smooth);
}

.nav-links a.logout-btn:hover {
    background-color: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
    text-shadow: none;
}

/* Light Cards & Panels */
.glass-panel {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    box-shadow: var(--shadow-md);
}

/* Login Page Styling */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 100px);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.login-card img.login-logo {
    height: 70px;
    margin-bottom: 20px;
}

.login-card h2 {
    font-family: var(--font-heading);
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--text-main);
}

.login-card p.subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.9rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--border-glow);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    font-family: var(--font-heading);
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    gap: 8px;
    font-size: 0.9rem;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-secondary:hover {
    background-color: var(--surface-hover);
    color: var(--text-main);
}

.btn-danger {
    background-color: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
}

.btn-danger:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

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

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-danger {
    background-color: #fef2f2; /* red-50 */
    border-color: #fca5a5;     /* red-300 */
    color: #991b1b;            /* red-800 */
}

.alert-success {
    background-color: #f0fdf4; /* green-50 */
    border-color: #86efac;     /* green-300 */
    color: #166534;            /* green-800 */
}

/* Filter Section */
.filter-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 18px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    align-items: flex-end;
}

/* Listing Grid & Cards */
.listings-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

/* Custom Responsive Listing Feed built entirely with DIVs */
.listing-card-div {
    display: flex;
    flex-direction: row;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-sm);
}

.listing-card-div:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    border-color: #cbd5e1;
}

.listing-img-container {
    width: 200px;
    min-width: 200px;
    position: relative;
    background-color: #f1f5f9;
}

.listing-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.listing-img-container .no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.listing-badge-portal {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(30, 41, 59, 0.8);
    color: #ffffff;
    font-weight: bold;
    padding: 3px 8px;
    font-size: 0.7rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.listing-badge-status {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-weight: 600;
    padding: 3px 8px;
    font-size: 0.7rem;
    border-radius: 4px;
    color: var(--text-inverse);
}

.status-new-bg {
    background-color: var(--status-new);
}

.status-suspicious-bg {
    background-color: var(--status-suspicious);
}

.status-ignored-bg {
    background-color: var(--status-ignored);
}

.listing-content-div {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.listing-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item strong {
    color: var(--text-main);
}

.listing-price-tag {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
}

.listing-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.listing-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listing-desc.expanded {
    -webkit-line-clamp: unset;
}

.listing-actions-audit {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.audit-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.audit-info span {
    color: var(--primary);
    font-weight: 600;
}

/* User tables and standard tabular views */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    text-align: left;
}

.custom-table th {
    font-family: var(--font-heading);
    background-color: #f1f5f9;
    padding: 14px 16px;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
    color: var(--text-main);
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.custom-table tr:hover {
    background-color: #f8fafc;
}

.table-actions {
    display: flex;
    gap: 8px;
}

/* Info stats blocks */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.stat-card .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    margin-top: 5px;
    color: var(--primary);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    margin-bottom: 30px;
}

.pagination a, .pagination span {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background-color: var(--surface);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: #fffbeb; /* very light red tint */
}

.pagination span.current {
    background-color: var(--primary);
    color: var(--text-inverse);
    font-weight: bold;
    border-color: var(--primary);
}

/* Dialog Modals */
dialog {
    background: var(--surface);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 25px;
    box-shadow: var(--shadow-lg);
}

/* Responsive Rules */
@media (max-width: 900px) {
    .listing-card-div {
        flex-direction: column;
    }
    
    .listing-img-container {
        width: 100%;
        height: 220px;
    }
    
    .listing-actions-audit {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
