* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    margin: 0;
}

/* Authentication Styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #4CAF50;
}

.auth-header p {
    color: #666;
    margin-bottom: 30px;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    margin-bottom: 30px;
    color: #333;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #4CAF50;
}

.auth-btn {
    width: 100%;
    background: #4CAF50;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-bottom: 20px;
}

.auth-btn:hover {
    background: #45a049;
}

.auth-switch {
    color: #666;
    font-size: 14px;
}

.auth-switch a {
    color: #4CAF50;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Header Updates */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    margin: 0;
}

.header-left p {
    margin: 5px 0 0 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-welcome {
    color: white;
    font-weight: 500;
}

.logout-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.price-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.price-category h4 {
    color: #2d3436;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid #ff6b6b;
    font-size: 1.2em;
    font-weight: bold;
}

.price-category:nth-child(2n) h4 {
    border-bottom-color: #4834d4;
}

.price-category:nth-child(3n) h4 {
    border-bottom-color: #00d2d3;
}

.price-category:nth-child(4n) h4 {
    border-bottom-color: #5f27cd;
}

.price-items {
    display: grid;
    gap: 8px;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.price-item:hover {
    background: #e8f5e8;
}

.price-item-name {
    font-weight: 500;
}

.price-item-price {
    color: #ff6b6b;
    font-weight: bold;
    font-size: 1.1em;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    text-align: center;
    padding: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #2d3436;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #000;
}

.tab-btn.active {
    background: #4CAF50;
    color: white;
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

.add-item-section {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 1px solid #dee2e6;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.add-item-section h3 {
    color: #2d3436;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.form-group input, .form-group select {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group input[type="text"] {
    flex: 2;
    min-width: 200px;
}

.form-group input[type="number"] {
    width: 80px;
}

.form-group select {
    min-width: 120px;
}

button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

button:hover {
    background: #45a049;
}

.shopping-lists {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.list-stats {
    display: flex;
    justify-content: space-between;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(116, 185, 255, 0.3);
}

.item-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
}

.item-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #eee;
    margin-bottom: 10px;
    border-radius: 5px;
    background: white;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: bold;
    color: #333;
}

.item-details {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.item-actions {
    display: flex;
    gap: 10px;
}

.item-actions button {
    padding: 5px 10px;
    font-size: 12px;
}

.delete-btn {
    background: #dc3545;
}

.delete-btn:hover {
    background: #c82333;
}

.clear-btn {
    background: #dc3545;
    width: 100%;
    margin-top: 20px;
}

.suggestions-list {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    padding: 20px;
    border-radius: 15px;
    border-left: 5px solid #fdcb6e;
    box-shadow: 0 5px 15px rgba(253, 203, 110, 0.2);
}

.suggestions-list h4 {
    color: #e17055;
    margin-bottom: 15px;
}

.suggestion-item {
    padding: 12px 15px;
    margin: 8px 0;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 3px solid #fdcb6e;
}

.suggestion-item:hover {
    background: #f8f9fa;
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
    transform: translateY(0);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(255, 107, 107, 0.4);
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #4834d4, #686de0);
    box-shadow: 0 8px 25px rgba(72, 52, 212, 0.3);
}

.stat-card:nth-child(2):hover {
    box-shadow: 0 12px 35px rgba(72, 52, 212, 0.4);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #00d2d3, #54a0ff);
    box-shadow: 0 8px 25px rgba(0, 210, 211, 0.3);
}

.stat-card:nth-child(3):hover {
    box-shadow: 0 12px 35px rgba(0, 210, 211, 0.4);
}

.stat-card h4 {
    margin-bottom: 15px;
    opacity: 0.9;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
}

.category-breakdown {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid #dee2e6;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.category-breakdown h4 {
    color: #2d3436;
    font-size: 1.3em;
    margin-bottom: 20px;
    text-align: center;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.category-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.category-bar {
    width: 200px;
    height: 20px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
    margin: 0 15px;
}

.category-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #ee5a24);
    transition: width 0.3s ease;
    border-radius: 10px;
}

.category-item:nth-child(2n) .category-fill {
    background: linear-gradient(90deg, #4834d4, #686de0);
}

.category-item:nth-child(3n) .category-fill {
    background: linear-gradient(90deg, #00d2d3, #54a0ff);
}

.category-item:nth-child(4n) .category-fill {
    background: linear-gradient(90deg, #5f27cd, #a55eea);
}

.category-item:nth-child(5n) .category-fill {
    background: linear-gradient(90deg, #00d8d6, #17c0eb);
}

.reminder-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.reminder-form input, .reminder-form select {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    flex: 1;
    min-width: 150px;
}

.reminders-container {
    display: grid;
    gap: 15px;
}

.reminder-card {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    padding: 20px;
    border-radius: 15px;
    border-left: 5px solid #ff6b6b;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.reminder-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.reminder-card:nth-child(2n) {
    border-left-color: #4834d4;
}

.reminder-card:nth-child(3n) {
    border-left-color: #00d2d3;
}

.reminder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.reminder-item {
    font-weight: bold;
    font-size: 18px;
}

.reminder-frequency {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
}

.family-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.family-code, .join-family, .family-members {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 1px solid #dee2e6;
}

.family-code h4, .join-family h4, .family-members h4 {
    color: #2d3436;
    margin-bottom: 15px;
}

.family-code p {
    font-size: 24px;
    font-weight: bold;
    color: white;
    margin: 15px 0;
    text-align: center;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

.join-family {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.join-family input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

#family-list {
    list-style: none;
}

#family-list li {
    padding: 10px;
    background: white;
    margin: 10px 0;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.member-status {
    background: linear-gradient(135deg, #00d2d3, #54a0ff);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(0, 210, 211, 0.3);
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .auth-card {
        padding: 30px 20px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-right {
        justify-content: center;
    }
    
    .shopping-lists {
        grid-template-columns: 1fr;
    }
    
    .form-group {
        flex-direction: column;
    }
    
    .form-group input, .form-group select, .form-group button {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .family-section {
        grid-template-columns: 1fr;
    }
    
    .price-categories {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1 1 50%;
        min-width: 120px;
    }
}