:root {
    --bg-color: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #ec4899;
    --accent: #06b6d4;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --danger: #ef4444;
    --success: #10b981;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
}

.gradient-text {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Authentication Pages */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-content {
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out forwards;
}

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

.auth-box {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-box h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

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

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.btn {
    display: inline-block;
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

/* Navbar */
.navbar {
    padding: 1rem 2rem;
    margin: 1rem auto;
    width: 95%;
    max-width: 1200px;
    border-radius: 16px;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 800;
}

.logo i {
    color: var(--accent);
}

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

.nav-link {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--glass-border);
    margin-left: auto;
}

.logout-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.25rem;
    transition: color 0.2s;
}

.logout-btn:hover {
    color: var(--danger);
}

/* Main Container */
.container {
    width: 95%;
    max-width: 1000px;
    margin: 2rem auto;
}

.list-header {
    margin-bottom: 2rem;
}

.list-header h2 {
    font-size: 2rem;
    margin-bottom: 0;
}

.add-item-form {
    padding: 1rem;
}

.add-item-form form {
    display: flex;
    gap: 1rem;
}

.add-item-form input {
    flex-grow: 1;
    background: rgba(15, 23, 42, 0.4);
}

.add-item-form .btn {
    width: auto;
    padding: 0.875rem 1.5rem;
    white-space: nowrap;
}

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

/* Shopping List */
.shopping-list-container {
    padding: 1rem;
}

.shopping-list {
    list-style: none;
}

.list-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
    transform: translateX(4px);
}

.list-item.completed {
    opacity: 0.6;
}

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

.item-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-name {
    font-size: 1.125rem;
    transition: all 0.3s ease;
    word-break: break-word;
}

.item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.delete-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Custom Checkbox */
.checkbox-container {
    display: block;
    position: relative;
    padding-left: 35px;
    margin-bottom: 24px;
    cursor: pointer;
    font-size: 22px;
    user-select: none;
    margin-right: 1rem;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 24px;
    width: 24px;
    background-color: rgba(15, 23, 42, 0.6);
    border: 2px solid var(--glass-border);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Admin Grid */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.add-user-panel, .users-list-panel {
    padding: 2rem;
}

.add-user-panel h3, .users-list-panel h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--accent);
}

.table-responsive {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th, .users-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.users-table th {
    font-weight: 600;
    color: var(--text-muted);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-admin {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}

.badge-user {
    background: rgba(6, 182, 212, 0.2);
    color: #a5f3fc;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
}

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

.btn-icon.danger:hover {
    color: #f87171;
}

.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.alert.error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert.success {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Animations */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(139, 92, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
    }
}

/* App Layout */
.app-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    width: 95%;
    max-width: 1400px;
    margin: 2rem auto;
    align-items: start;
}

.sidebar {
    padding: 1.5rem;
    position: sticky;
    top: 6rem;
}

.sidebar-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.create-list-form {
    margin-bottom: 2rem;
}

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

.checkbox-container-small {
    margin-bottom: 0;
    font-size: 0.875rem;
    padding-left: 28px;
    color: var(--text-muted);
    line-height: 18px;
    min-height: 18px;
    margin-right: 0;
}

.checkmark-small {
    height: 18px;
    width: 18px;
    border-radius: 4px;
    top: 50%;
    transform: translateY(-50%);
}

.checkbox-container-small input:checked ~ .checkmark-small:after {
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
}

.btn-small {
    padding: 0.75rem;
    font-size: 0.875rem;
}

.w-100 {
    width: 100%;
}

.lists-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.list-menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.list-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.list-menu-item.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--primary);
}

.list-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.5);
    color: var(--primary);
}

.list-info {
    flex-grow: 1;
    overflow: hidden;
}

.list-name {
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.list-settings-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    display: none;
    transition: all 0.3s ease;
}

.list-menu-item:hover .list-settings-btn,
.list-menu-item.active .list-settings-btn {
    display: block;
    color: var(--text-main);
}

.list-settings-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-blue);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--glass-border);
}

.list-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    .navbar {
        padding: 1rem;
        width: 100%;
        border-radius: 0;
        margin: 0;
        top: 0;
    }

    .app-container {
        grid-template-columns: 1fr;
        width: 100%;
        padding: 0 1rem;
        margin-top: 1rem;
    }
    
    .sidebar {
        position: static;
        margin-bottom: 2rem;
        padding: 1rem;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    .add-item-form form {
        flex-direction: column;
    }
    
    .nav-content {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .nav-links {
        width: 100%;
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .user-profile {
        padding-left: 0.75rem;
        gap: 0.75rem;
    }
    
    .glass-container {
        padding: 1.5rem;
    }
    
    .list-item {
        padding: 0.75rem;
    }
    
    .checkbox-container {
        margin-right: 0.5rem;
    }

    .modal-overlay {
        align-items: flex-start;
        padding-top: 2rem;
        overflow-y: auto;
    }
}
