/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-light: #e5e7eb;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: all 0.2s ease;
}

/* === Layout === */
.container {
    width: 100%;
    max-width: 1200px;
    /* Wider for desktop */
    margin: 0 auto;
    padding: 2rem;
    flex-grow: 1;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    padding: 2rem;
}

/* === Header === */
.header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header h1 i {
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* === Components === */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-light);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.auth-card {
    background: #fff;
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    text-align: center;
}

/* === Forms === */
.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background-color: #f9fafb;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-control:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: var(--primary-gradient);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background: #d1d5db;
    box-shadow: none;
}

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

.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* === Dashboard & Lists === */
.list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    /* Wider cards */
    gap: 2rem;
}

.list-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 1.75rem;
    border: 1px solid var(--border-light);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
    position: relative;
    overflow: hidden;
}

.list-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
}

.list-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.list-card h4 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    font-weight: 700;
}

/* === List View (Important Improvements) === */
.list-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: var(--radius-md);
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.summary-item strong {
    font-size: 1.75rem;
    color: var(--text-main);
    font-weight: 800;
}

/* Add Item Form Layout */
#form-add-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.item-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.item-row:hover {
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.item-row.comprado {
    background: #f9fafb;
    border-color: transparent;
    opacity: 0.7;
}

.checkbox-wrapper {
    margin-right: 1.5rem;
    display: flex;
    align-items: center;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.item-details {
    display: flex;
    flex-direction: column;
}

.item-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

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

.item-actions button,
.item-actions a {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f3f4f6;
    color: var(--text-muted);
    transition: all 0.2s;
}

.item-actions button:hover,
.item-actions a:hover {
    background: var(--primary-color);
    color: white;
}

.item-actions .btn-delete:hover {
    background: var(--danger);
    color: white;
}

/* === Responsive === */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.2rem;
    }

    .list-summary {
        grid-template-columns: 1fr;
    }

    #form-add-item {
        grid-template-columns: 1fr 1fr;
    }

    #form-add-item div:first-child {
        grid-column: 1 / -1;
    }

    #form-add-item div:last-child {
        grid-column: 1 / -1;
    }

    .btn {
        width: 100%;
    }
}

/* === Modals === */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    /* Changed from block to flex for centering */
    opacity: 1;
}

.modal-content {
    background-color: #fff;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    animation: modalSlideIn 0.3s forwards;
}

@keyframes modalSlideIn {
    to {
        transform: scale(1);
    }
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: var(--text-muted);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close-modal:hover {
    color: var(--danger);
}

.modal h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-main);
    font-weight: 700;
    text-align: center;
}

.modal .form-group {
    margin-bottom: 1.5rem;
}

.modal .btn {
    width: 100%;
    margin-top: 1rem;
}