/* Mediterranean Minimalist Theme for Habit Tracker */

/* Color Palette Variables */
:root {
    --ecru: #F7F3EB;
    --dusty-blue: #A0B5C8;
    --terracotta: #C67B5A;
    --olive-green: #8A9A5B;
    --sand: #D6C7A1;
    --soft-charcoal: #4B4B4B;
    
    /* Subtle variations for depth */
    --ecru-dark: #F2EDE3;
    --dusty-blue-light: #B5C6D5;
    --dusty-blue-dark: #8FA7BD;
    --terracotta-light: #D18B6F;
    --olive-light: #9BAA6F;
    --sand-light: #E1D4B1;
}

/* Base Styles */
body {
    background: var(--ecru);
    color: var(--soft-charcoal);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    letter-spacing: 0.015em;
}

/* Typography */
h1, h2, h3 {
    color: var(--soft-charcoal);
    font-weight: 300;
}

/* Header */
.text-center h1 {
    color: var(--soft-charcoal);
    margin-bottom: 0.5rem;
}

.text-center p {
    color: var(--soft-charcoal);
    opacity: 0.7;
}

/* Card Styles */
.bg-white {
    background: rgba(247, 243, 235, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(160, 181, 200, 0.1);
    box-shadow: 0 4px 20px rgba(75, 75, 75, 0.05);
}

.rounded-xl {
    border-radius: 16px;
}

/* Form Elements */
input, select {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(160, 181, 200, 0.2);
    color: var(--soft-charcoal);
    transition: all 0.3s ease;
}

input:focus, select:focus {
    border-color: var(--dusty-blue);
    box-shadow: 0 0 0 3px rgba(160, 181, 200, 0.1);
    outline: none;
    background: rgba(255, 255, 255, 0.95);
}

input::placeholder {
    color: var(--soft-charcoal);
    opacity: 0.5;
}

/* Labels */
label {
    color: var(--soft-charcoal);
    font-weight: 300;
    opacity: 0.8;
}

/* Habit Grid */
.habit-cell {
    aspect-ratio: 1;
    min-height: 64px;
    border: 1px solid rgba(160, 181, 200, 0.15);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 300;
    position: relative;
    background: rgba(255, 255, 255, 0.3);
    user-select: none;
    color: var(--soft-charcoal);
}

.habit-cell:hover {
    border-color: var(--dusty-blue);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(160, 181, 200, 0.2);
    background: rgba(255, 255, 255, 0.5);
}

.habit-cell.completed {
    background: linear-gradient(135deg, var(--olive-green) 0%, var(--olive-light) 100%);
    border-color: var(--olive-green);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(138, 154, 91, 0.25);
}

.habit-cell.completed:hover {
    background: linear-gradient(135deg, var(--olive-light) 0%, var(--olive-green) 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(138, 154, 91, 0.3);
}

.habit-cell.today {
    border-color: var(--terracotta);
    border-width: 2px;
    background: rgba(198, 123, 90, 0.1);
}

.habit-cell.today.completed {
    background: linear-gradient(135deg, var(--terracotta) 0%, var(--terracotta-light) 100%);
    border-color: var(--terracotta);
    box-shadow: 0 4px 20px rgba(198, 123, 90, 0.3);
}

.habit-cell .day-number {
    font-weight: 400;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.habit-cell .duration {
    font-size: 0.65rem;
    opacity: 0.9;
    margin-top: 2px;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

.habit-cell.completed .duration {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.2);
}

.habit-cell.today .day-number {
    color: var(--terracotta);
    font-weight: 500;
}

/* Stats Cards */
.stats-card {
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(75, 75, 75, 0.08);
}

/* Stats Colors */
#completion-counter {
    color: var(--olive-green);
}

#current-streak {
    color: var(--dusty-blue);
}

#completion-rate {
    color: var(--terracotta);
}

#total-duration {
    color: var(--sand);
    color: #B8A082;
}

/* Modal */
#duration-modal {
    backdrop-filter: blur(12px);
    background: rgba(75, 75, 75, 0.1);
}

#duration-modal .bg-white {
    background: var(--ecru);
    border: 1px solid rgba(160, 181, 200, 0.1);
    box-shadow: 0 20px 60px rgba(75, 75, 75, 0.15);
}

#duration-modal.show {
    display: flex !important;
    animation: fadeIn 0.3s ease-out;
}

#duration-modal .bg-white {
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Button Styles */
#save-duration {
    background: var(--olive-green);
    color: white;
    border: 1px solid var(--olive-green);
}

#save-duration:hover {
    background: var(--olive-light);
    border-color: var(--olive-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(138, 154, 91, 0.25);
}

#cancel-duration {
    background: rgba(160, 181, 200, 0.1);
    color: var(--soft-charcoal);
    border: 1px solid rgba(160, 181, 200, 0.2);
}

#cancel-duration:hover {
    background: rgba(160, 181, 200, 0.15);
    border-color: var(--dusty-blue);
    transform: translateY(-1px);
}

/* Legend */
.legend-item {
    color: var(--soft-charcoal);
    opacity: 0.7;
    font-size: 0.85rem;
    font-weight: 300;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.success-pulse {
    animation: successPulse 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes successPulse {
    0% { transform: translateY(-1px); }
    50% { 
        transform: translateY(-5px) scale(1.08);
        box-shadow: 0 0 0 8px rgba(138, 154, 91, 0.2);
    }
    100% { 
        transform: translateY(-1px);
        box-shadow: 0 4px 20px rgba(138, 154, 91, 0.25);
    }
}

/* Input Focus Refinements */
input:focus, select:focus {
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 640px) {
    .habit-cell {
        min-height: 52px;
        font-size: 0.75rem;
    }
    
    .habit-cell .day-number {
        font-size: 0.85rem;
    }
    
    .habit-cell .duration {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .habit-cell {
        min-height: 48px;
        font-size: 0.7rem;
    }
    
    .habit-cell .day-number {
        font-size: 0.8rem;
    }
    
    .habit-cell .duration {
        font-size: 0.55rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .habit-cell,
    button,
    input,
    select {
        transition: none;
    }
    
    .success-pulse {
        animation: none;
    }
    
    #duration-modal.show,
    #duration-modal .bg-white {
        animation: none;
    }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    .habit-cell {
        border-width: 2px;
    }
    
    .habit-cell.completed {
        background: var(--olive-green);
        border-color: var(--soft-charcoal);
    }
}

/* Subtle shadows and depth */
.shadow-sm {
    box-shadow: 0 2px 8px rgba(75, 75, 75, 0.06);
}

/* Remove Tailwind overrides and apply Mediterranean theme */
.bg-gradient-to-br {
    background: var(--ecru) !important;
}

/* Stats text colors */
.text-green-600 {
    color: var(--olive-green) !important;
}

.text-blue-600 {
    color: var(--dusty-blue) !important;
}

.text-purple-600 {
    color: var(--terracotta) !important;
}

.text-orange-600 {
    color: #B8A082 !important;
}

/* Text colors */
.text-slate-600,
.text-slate-700 {
    color: var(--soft-charcoal) !important;
    opacity: 0.8;
}

.text-slate-800 {
    color: var(--soft-charcoal) !important;
}

/* Border colors */
.border-slate-200 {
    border-color: rgba(160, 181, 200, 0.15) !important;
}

.border-slate-100 {
    border-color: rgba(160, 181, 200, 0.1) !important;
}

/* Habit Switcher Styles */
.habit-switcher {
    background: rgba(160, 181, 200, 0.08) !important;
    border-radius: 10px;
    padding: 4px;
}

.habit-tab {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--soft-charcoal);
    font-size: 0.875rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
    min-width: 80px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.habit-tab:hover {
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.habit-tab.active {
    background: rgba(255, 255, 255, 0.9);
    color: var(--soft-charcoal);
    opacity: 1;
    box-shadow: 0 2px 8px rgba(160, 181, 200, 0.15);
    transform: translateY(-1px);
}

.habit-tab.active:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(160, 181, 200, 0.2);
}

/* Override Tailwind background for habit switcher */
.bg-slate-50 {
    background: rgba(160, 181, 200, 0.08) !important;
}

/* Empty grid cells for alignment */
.habit-cell-empty {
    aspect-ratio: 1;
    min-height: 64px;
    /* Invisible placeholder to maintain grid alignment */
}

/* Responsive adjustments for empty cells */
@media (max-width: 640px) {
    .habit-cell-empty {
        min-height: 52px;
    }
}

@media (max-width: 480px) {
    .habit-cell-empty {
        min-height: 48px;
    }
}