/* ============================================================
   Inzertní web — Custom CSS
   Uses Tailwind CSS for utilities; this file adds custom components
   ============================================================ */

:root {
    --color-primary:   #09B1BA;
    --color-secondary: #F5F5F5;
    --color-accent:    #FF6B6B;
    --color-text:      #1A1A2E;
    --color-muted:     #9E9E9E;
    --color-white:     #FFFFFF;
    --color-border:    #E8E8E8;

    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  16px;
    --radius-xl:  24px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ============================================================
   Base Reset & Body
   ============================================================ */

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--color-text);
    background-color: var(--color-secondary);
    min-height: 100vh;
    line-height: 1.5;
}

/* ============================================================
   Scrollbar utilities
   ============================================================ */
.scrollbar-none::-webkit-scrollbar { display: none; }
.scrollbar-none { -ms-overflow-style: none; scrollbar-width: none; }

/* ============================================================
   Ad Card Component
   ============================================================ */
.ad-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.ad-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.ad-card__image {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--color-secondary);
}

.ad-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ad-card:hover .ad-card__image img {
    transform: scale(1.04);
}

.ad-card__info {
    padding: 12px;
}

.ad-card__price {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--color-accent);
}

.ad-card__title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   Ads Grid
   ============================================================ */
.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

@media (max-width: 480px) {
    .ads-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* ============================================================
   Site Header
   ============================================================ */
.site-header {
    background: var(--color-white);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--color-border);
}

/* ============================================================
   Search Bar
   ============================================================ */
.search-bar input {
    border: 1.5px solid var(--color-border);
    border-radius: 999px;
    padding: 8px 48px 8px 20px;
    font-size: 0.875rem;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(9, 177, 186, 0.15);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
}

.btn-primary:hover {
    background: #079da5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(9, 177, 186, 0.3);
}

.btn-secondary {
    background: var(--color-secondary);
    color: var(--color-text);
    border: 1.5px solid var(--color-border);
}

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

.btn-accent {
    background: var(--color-accent);
    color: var(--color-white);
}

.btn-accent:hover {
    background: #e05555;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

/* ============================================================
   Form Components
   ============================================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
}

.form-input {
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--color-white);
    color: var(--color-text);
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(9, 177, 186, 0.15);
}

.form-input::placeholder {
    color: var(--color-muted);
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
}

select.form-input {
    cursor: pointer;
}

/* ============================================================
   Avatar
   ============================================================ */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
}

.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 48px; height: 48px; }
.avatar-lg { width: 72px; height: 72px; }
.avatar-xl { width: 96px; height: 96px; }

/* ============================================================
   Badge / Tag
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary { background: rgba(9, 177, 186, 0.1); color: var(--color-primary); }
.badge-success { background: rgba(34, 197, 94, 0.1); color: #16a34a; }
.badge-warning { background: rgba(234, 179, 8, 0.1); color: #ca8a04; }
.badge-danger  { background: rgba(255, 107, 107, 0.1); color: var(--color-accent); }
.badge-muted   { background: var(--color-secondary); color: var(--color-muted); }

/* ============================================================
   Condition badge on ad card image
   ============================================================ */
.condition-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 0;
    flex-wrap: wrap;
}

.pagination-item {
    min-width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    border: 1.5px solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
    transition: all 0.15s;
    padding: 0 10px;
}

.pagination-item:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination-item.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    font-weight: 600;
}

/* ============================================================
   Star rating
   ============================================================ */
.stars {
    display: inline-flex;
    gap: 2px;
}

.star-filled { color: #fbbf24; }
.star-empty  { color: var(--color-muted); }

/* ============================================================
   User profile page
   ============================================================ */
.profile-sidebar {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    padding: 16px 0;
    border-top: 1px solid var(--color-border);
    margin-top: 16px;
}

.profile-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.profile-stat-label {
    font-size: 0.75rem;
    color: var(--color-muted);
}

/* ============================================================
   Messages
   ============================================================ */
.message-bubble {
    max-width: 280px;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.875rem;
    line-height: 1.4;
    word-break: break-word;
}

.message-bubble.mine {
    background: var(--color-primary);
    color: white;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.message-bubble.theirs {
    background: var(--color-secondary);
    color: var(--color-text);
    border-bottom-left-radius: 4px;
}

/* ============================================================
   Admin panel
   ============================================================ */
.admin-stat-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.admin-table th {
    background: var(--color-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.admin-table td {
    padding: 12px 20px;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   Hero section
   ============================================================ */
.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, #06a0a8 100%);
    border-radius: var(--radius-xl);
    padding: 48px 32px;
    color: white;
    text-align: center;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.hero p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.125rem;
}

/* ============================================================
   Responsive adjustments
   ============================================================ */

@media (max-width: 480px) {
    .ad-card__price { font-size: 1rem; }
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: 1rem; }
}

@media (min-width: 768px) {
    .ads-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (min-width: 1024px) {
    .ads-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* ============================================================
   Image upload drag zone
   ============================================================ */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover, .upload-zone.dragging {
    border-color: var(--color-primary);
    background: rgba(9, 177, 186, 0.04);
}

/* ============================================================
   Line clamp utilities
   ============================================================ */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   Alpine.js x-cloak
   ============================================================ */
[x-cloak] {
    display: none !important;
}
