/* CSS Variables */
:root {
    --primary-color: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary-color: #f472b6;
    --secondary-light: #f9a8d4;
    --accent-color: #34d399;
    --accent-light: #6ee7b7;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #475569;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --gradient-accent: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

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

.logo {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
}

header h1 {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: 10px;
}

/* Main Content */
main {
    flex: 1;
}

section {
    margin-bottom: 50px;
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-icon {
    font-size: 1.3rem;
}

/* Affirmation Section */
.affirmation-section {
    text-align: center;
}

.affirmation-card {
    background: var(--gradient-primary);
    padding: 50px 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.affirmation-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(255,255,255,0.1), transparent);
    pointer-events: none;
}

.affirmation-icon {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.affirmation-text {
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    font-weight: 500;
    line-height: 1.5;
    max-width: 800px;
    margin: 0 auto;
}

.affirmation-category {
    margin-top: 20px;
    font-size: 0.9rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-light);
    border-color: var(--primary-color);
}

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

.btn-accent:hover:not(:disabled) {
    background: var(--accent-light);
    transform: translateY(-2px);
}

.btn-icon-only {
    background: var(--surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
}

.btn-icon-only:hover {
    background: var(--surface-light);
    border-color: var(--primary-color);
}

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

/* Customization Section */
.customization-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.customization-card,
.scheduling-card,
.stats-card,
.calendar-card,
.saved-affirmations-card {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.customization-card h3,
.scheduling-card h3,
.stats-card h3,
.calendar-card h3,
.saved-affirmations-card h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

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

.personal-input {
    grid-column: 1 / -1;
}

/* Checkbox & Radio Styles */
.checkbox-group,
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 10px 15px;
    background: var(--surface-light);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.checkbox-label:hover,
.radio-label:hover {
    background: var(--border-color);
}

.checkbox-label input,
.radio-label input {
    display: none;
}

.checkmark,
.radiomark {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.radiomark {
    border-radius: 50%;
}

.checkbox-label input:checked + .checkmark,
.radio-label input:checked + .radiomark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 14px;
}

.radio-label input:checked + .radiomark::after {
    content: '';
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-group textarea {
    min-height: 100px;
    resize: vertical;
}

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

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

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

.slider::before {
    position: absolute;
    content: '';
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

.switch input:checked + .slider {
    background: var(--primary-color);
}

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

/* Scheduling Section */
.reminder-toggle {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.reminder-options {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

.frequency-options {
    margin-bottom: 20px;
}

.frequency-options label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.frequency-options .radio-group {
    flex-direction: row;
    flex-wrap: wrap;
}

.frequency-options .radio-label {
    flex: 1;
    min-width: 140px;
}

.custom-days {
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--surface-light);
    border-radius: var(--radius-sm);
}

.custom-days.active {
    display: flex;
}

.day-checkbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.day-checkbox input {
    display: none;
}

.day-checkbox span {
    padding: 10px 15px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.day-checkbox input:checked + span {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.notification-status {
    margin-top: 15px;
    padding: 15px;
    border-radius: var(--radius-sm);
    display: none;
}

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

.notification-status.success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.notification-status.error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.notification-status.warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

/* Reinforcement Section */
.reinforcement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.streak-card {
    background: var(--gradient-accent);
    padding: 30px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-md);
}

.streak-number {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
}

.streak-label {
    font-size: 1.2rem;
    margin: 10px 0;
    opacity: 0.9;
}

.streak-message {
    font-size: 0.95rem;
    opacity: 0.8;
}

.achievements-card {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.achievement {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    background: var(--surface-light);
    border-radius: var(--radius-sm);
    text-align: center;
    transition: var(--transition);
    cursor: default;
}

.achievement.locked {
    opacity: 0.4;
    filter: grayscale(100%);
}

.achievement.unlocked {
    opacity: 1;
    filter: none;
    background: var(--gradient-primary);
}

.achievement-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.achievement-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.achievement.unlocked .achievement-name {
    color: white;
}

.daily-challenge {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.daily-challenge h3 {
    margin-bottom: 15px;
}

.daily-challenge p {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.challenge-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.challenge-progress input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

/* Progress Section */
.progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 15px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: var(--surface-light);
    border-radius: var(--radius-sm);
}

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

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Calendar */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-header span {
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day-header {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 5px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.calendar-day.active {
    background: var(--primary-color);
    color: white;
}

.calendar-day.today {
    border: 2px solid var(--accent-color);
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-legend {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.active {
    background: var(--primary-color);
}

.legend-dot.today {
    border: 2px solid var(--accent-color);
}

/* Saved Affirmations */
.saved-list {
    max-height: 400px;
    overflow-y: auto;
}

.saved-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    background: var(--surface-light);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.saved-item:last-child {
    margin-bottom: 0;
}

.saved-item-content {
    flex: 1;
}

.saved-item-text {
    color: var(--text-primary);
    margin-bottom: 5px;
}

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

.saved-item-actions {
    display: flex;
    gap: 10px;
}

.saved-item-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    transition: var(--transition);
}

.saved-item-actions button:hover {
    color: var(--primary-color);
}

.saved-item-actions .delete-btn:hover {
    color: var(--error);
}

.empty-message {
    color: var(--text-muted);
    text-align: center;
    padding: 30px;
}

/* Footer */
footer {
    margin-top: auto;
    padding: 30px 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.powered-by {
    margin-top: 10px;
}

.powered-by a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

.powered-by a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.affirmation-card.generating {
    animation: pulse 1s ease infinite;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--error);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

    header {
        padding: 30px 15px;
    }

    .logo-container {
        flex-direction: column;
    }

    .affirmation-card {
        padding: 35px 20px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .customization-grid,
    .reinforcement-grid,
    .progress-grid {
        grid-template-columns: 1fr;
    }

    .frequency-options .radio-group {
        flex-direction: column;
    }

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

    .achievements-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .toast {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.95rem;
    }

    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .calendar-day {
        font-size: 0.75rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Focus Styles for Accessibility */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .action-buttons,
    .customization-section,
    .scheduling-section,
    footer {
        display: none;
    }

    .affirmation-card {
        box-shadow: none;
        border: 2px solid #000;
    }
}
