/* Modern and Responsive CSS for Seznam App (Indigo/Teal Palette) */

:root {
    --primary-color: #6366f1; /* Deep Indigo */
    --primary-hover: #4f46e5;
    --success-color: #10b981; /* Emerald green for checkmarks */
    --success-hover: #059669;
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.75);
    --card-border: rgba(255, 255, 255, 0.6);
    --text-color: #1e293b;
    --text-muted: #64748b;
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --shadow: 0 10px 30px rgba(99, 102, 241, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.05);
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --input-bg: #1e293b;
    --input-border: #334155;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
    padding-bottom: 3rem;
}

/* Background Gradients */
.bg-decor {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0) 70%);
    z-index: -1;
    filter: blur(40px);
}
.bg-decor-1 { top: -100px; right: -100px; }
.bg-decor-2 { bottom: -100px; left: -100px; }

/* Global Layout */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.8rem;
    color: var(--primary-color);
}

h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

/* Theme Toggle */
.btn-icon {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    padding: 0.6rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

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

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

/* Glass Card */
.glass {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

/* Lists Grid */
.lists-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media(min-width: 768px) {
    .lists-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.list-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.2rem;
}

.list-title {
    font-size: 1.2rem;
    font-weight: 700;
    word-break: break-word;
}

.list-menu-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
    border-radius: 4px;
}

.list-menu-btn:hover {
    color: var(--text-color);
}

/* Recipes Badges */
.list-recipes-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.recipe-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.07);
    border: 1px solid rgba(99, 102, 241, 0.12);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Items List */
.items-list {
    margin-bottom: 1.2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    position: relative;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.015);
    border: 1px solid rgba(0, 0, 0, 0.02);
    transition: var(--transition);
    overflow: hidden;
}

[data-theme="dark"] .item-row {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.01);
}

.item-row:hover {
    background: rgba(99, 102, 241, 0.03);
}

.item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    flex-grow: 1;
}

/* Checkbox Custom styling */
.custom-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--input-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: transparent;
    font-size: 0.75rem;
}

.item-row.checked .custom-checkbox {
    border-color: var(--success-color);
    background: var(--success-color);
    color: #ffffff;
}

.item-name {
    font-size: 0.95rem;
    transition: var(--transition);
}

.item-row.checked .item-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.item-right-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 65px;
    height: 28px;
}

.item-amount-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.07);
    border: 1px solid rgba(99, 102, 241, 0.12);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-variant-numeric: tabular-nums;
    transition: var(--transition);
    opacity: 1;
}

[data-theme="dark"] .item-amount-badge {
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.25);
}

.item-row:hover .item-amount-badge {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-5px);
}

/* Quick Add Input */
.quick-add-group {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.quick-add-input {
    flex-grow: 1;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    padding: 0.6rem 0.9rem;
    border-radius: 30px;
    outline: none;
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
}

.quick-add-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    padding: 2rem;
    border-radius: 16px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: scaleUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Form controls */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    background: var(--bg-color);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    background: var(--input-bg);
}

/* History / Completed Section */
.history-section {
    margin-top: 4rem;
}

.history-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--input-border);
    padding-bottom: 0.75rem;
}

.history-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.history-count {
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--input-border);
    color: var(--text-muted);
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-card {
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.history-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-card-title {
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: line-through;
    color: var(--text-muted);
}

.history-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.history-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Accordion expand button */
.history-toggle-btn {
    width: 100%;
    margin-top: 1.5rem;
    background: none;
    border: 1px dashed var(--input-border);
    color: var(--primary-color);
    padding: 0.8rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.history-toggle-btn:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.03);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* Context menu */
.context-menu {
    position: absolute;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 0.4rem 0;
    z-index: 100;
    width: 160px;
    animation: scaleUp 0.15s ease-out;
}

.context-menu-item {
    padding: 0.5rem 1rem;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    transition: var(--transition);
}

.context-menu-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary-color);
}

.context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}

/* Item row actions */
.item-actions {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) translateX(5px);
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.item-row:hover .item-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

@media (max-width: 768px) {
    .item-right-container {
        min-width: auto;
        width: auto;
        gap: 0.4rem;
        height: auto;
    }
    
    .item-amount-badge {
        opacity: 1 !important;
        transform: none !important;
    }
    
    .item-actions {
        position: static;
        transform: none !important;
        opacity: 0.6;
        pointer-events: auto;
    }
}

.item-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.3rem;
    border-radius: 4px;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-action-btn:hover {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.08);
}

.item-action-btn.delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.item-action-btn.kupi-btn:hover {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.08);
}

.item-action-btn.rohlik-btn:hover {
    color: #8ac33e;
    background: rgba(138, 195, 62, 0.08);
}

.item-edit-inline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    animation: fadeIn 0.2s ease;
}

.item-edit-input {
    flex-grow: 1;
}

/* Bottom Sheet for mobile actions */
.bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.bottom-sheet-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.bottom-sheet-content {
    position: relative;
    z-index: 1001;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: var(--card-bg);
    border-top: 1px solid var(--card-border);
    border-radius: 24px 24px 0 0;
    padding: 1.5rem;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(20px);
}

.bottom-sheet-drag-handle {
    width: 40px;
    height: 5px;
    background: var(--text-muted);
    opacity: 0.3;
    border-radius: 3px;
    margin: -0.5rem auto 1.2rem auto;
}

.bottom-sheet-title {
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.bottom-sheet-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.bottom-sheet-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 1.25rem;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
}

.bottom-sheet-btn:active, .bottom-sheet-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.bottom-sheet-btn.kupi:hover {
    color: var(--success-color);
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.08);
}

.bottom-sheet-btn.rohlik:hover {
    color: #8ac33e;
    border-color: #8ac33e;
    background: rgba(138, 195, 62, 0.08);
}

.bottom-sheet-btn.delete {
    color: #ef4444;
}
.bottom-sheet-btn.delete:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
}

.bottom-sheet-close-btn {
    width: 100%;
    padding: 0.88rem;
    border-radius: 14px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
