/* CSS Reset and Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #6C63FF;
    --primary-dark: #5A52D5;
    --primary-light: #8B85FF;
    --secondary-color: #FF6B6B;
    --accent-color: #4ECDC4;
    --success-color: #2ECC71;
    --warning-color: #F39C12;
    --background-color: #F8F9FE;
    --card-background: #FFFFFF;
    --text-primary: #2D3748;
    --text-secondary: #718096;
    --text-light: #A0AEC0;
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --border-radius-lg: 20px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    text-align: center;
    padding: 30px 20px;
    color: white;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo {
    width: 50px;
    height: 50px;
    border-radius: 12px;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 5px;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Section Styles */
section {
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-lg);
}

section h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* Affirmation Display */
.affirmation-display {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.affirmation-card {
    text-align: center;
    padding: 30px 20px;
    position: relative;
}

.quote-icon {
    font-size: 4rem;
    opacity: 0.2;
    position: absolute;
    top: 10px;
    left: 20px;
    font-family: Georgia, serif;
}

.affirmation-text {
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.affirmation-category {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    text-transform: capitalize;
}

.affirmation-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-icon {
    font-size: 1.1rem;
}

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

.btn-primary:hover {
    background: var(--background-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

section:not(.affirmation-display) .btn-primary {
    background: var(--primary-color);
    color: white;
}

section:not(.affirmation-display) .btn-primary:hover {
    background: var(--primary-dark);
}

section:not(.affirmation-display) .btn-secondary {
    background: var(--background-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

section:not(.affirmation-display) .btn-secondary:hover {
    background: var(--border-color);
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.category-item {
    cursor: pointer;
}

.category-item input {
    display: none;
}

.category-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    background: var(--background-color);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.category-item input:checked + .category-label {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    color: white;
    border-color: var(--primary-dark);
}

.category-label:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.category-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.category-name {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Custom Affirmations */
.custom-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.custom-input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.custom-input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.custom-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.custom-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--background-color);
    border-radius: var(--border-radius);
    gap: 10px;
}

.custom-item-text {
    flex: 1;
    font-size: 0.95rem;
}

.custom-item-delete {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 5px;
    font-size: 1.2rem;
    opacity: 0.7;
    transition: var(--transition);
}

.custom-item-delete:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Reminder Section */
.reminder-settings {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.reminder-toggle {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toggle-label {
    font-weight: 500;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-light);
    transition: var(--transition);
    border-radius: 30px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.switch input:checked + .slider {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.switch input:checked + .slider:before {
    transform: translateX(26px);
}

.reminder-time-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    opacity: 0.5;
    pointer-events: none;
    transition: var(--transition);
}

.reminder-time-group.active {
    opacity: 1;
    pointer-events: auto;
}

.reminder-time-group label {
    font-weight: 500;
}

.reminder-time-group input[type="time"] {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.reminder-time-group input[type="time"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.reminder-status {
    padding: 12px 16px;
    background: var(--background-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: none;
}

.reminder-status.active {
    display: block;
}

.reminder-status.success {
    background: rgba(46, 204, 113, 0.1);
    color: var(--success-color);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: linear-gradient(135deg, var(--background-color) 0%, white 100%);
    padding: 20px 15px;
    border-radius: var(--border-radius);
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-icon {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Favorites */
.favorites-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.favorite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--background-color);
    border-radius: var(--border-radius);
    gap: 10px;
}

.favorite-item-text {
    flex: 1;
    font-size: 0.95rem;
}

.favorite-item-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: white;
    padding: 3px 8px;
    border-radius: 10px;
}

.favorite-item-delete {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 5px;
    font-size: 1rem;
    opacity: 0.7;
    transition: var(--transition);
}

.favorite-item-delete:hover {
    opacity: 1;
}

/* Achievement Section */
.achievement-section {
    margin-top: 20px;
}

.achievement-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: var(--border-radius);
    color: #5D4E00;
    animation: achievementPop 0.5s ease;
}

@keyframes achievementPop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.achievement-icon {
    font-size: 2rem;
}

.achievement-content h4 {
    font-size: 1rem;
    margin-bottom: 3px;
}

.achievement-content p {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Footer */
footer {
    text-align: center;
    padding: 25px 20px;
    color: white;
    font-size: 0.9rem;
}

footer a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

footer a:hover {
    text-decoration: underline;
    opacity: 0.9;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 14px 28px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 0.95rem;
}

/* Scrollbar Styling */
.custom-list::-webkit-scrollbar,
.favorites-list::-webkit-scrollbar {
    width: 6px;
}

.custom-list::-webkit-scrollbar-track,
.favorites-list::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 3px;
}

.custom-list::-webkit-scrollbar-thumb,
.favorites-list::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 3px;
}

.custom-list::-webkit-scrollbar-thumb:hover,
.favorites-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .app-container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.95rem;
    }

    section {
        padding: 20px 15px;
    }

    .affirmation-text {
        font-size: 1.25rem;
    }

    .quote-icon {
        font-size: 3rem;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .category-label {
        padding: 12px 8px;
    }

    .category-icon {
        font-size: 1.5rem;
    }

    .category-name {
        font-size: 0.8rem;
    }

    .custom-input-group {
        flex-direction: column;
    }

    .custom-input-group .btn {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 15px 10px;
    }

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

    .stat-label {
        font-size: 0.7rem;
    }

    .reminder-time-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .affirmation-actions {
        flex-direction: column;
        gap: 8px;
    }

    .affirmation-actions .btn {
        width: 100%;
    }
}

@media (max-width: 400px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        display: flex;
        align-items: center;
        gap: 15px;
        text-align: left;
    }

    .stat-icon {
        margin-bottom: 0;
    }

    .logo-container {
        flex-direction: column;
        gap: 10px;
    }
}

/* Animation for affirmation change */
.affirmation-text.fade {
    animation: fadeInUp 0.5s ease;
}

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

/* Pulse animation for generate button */
.btn-primary.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}
