/* Material Design 3 Design Tokens */
:root {
    /* Material Design 3 Color System */
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    
    --md-sys-color-secondary: #625B71;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #E8DEF8;
    --md-sys-color-on-secondary-container: #1D192B;
    
    --md-sys-color-tertiary: #7D5260;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #FFD8E4;
    --md-sys-color-on-tertiary-container: #31111D;
    
    --md-sys-color-error: #BA1A1A;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #FFDAD6;
    --md-sys-color-on-error-container: #410002;
    
    --md-sys-color-success: #0D7377;
    --md-sys-color-on-success: #FFFFFF;
    --md-sys-color-success-container: #14FFEC;
    --md-sys-color-on-success-container: #002022;
    
    --md-sys-color-surface: #FFFBFE;
    --md-sys-color-on-surface: #1C1B1F;
    --md-sys-color-surface-variant: #E7E0EC;
    --md-sys-color-on-surface-variant: #49454F;
    
    --md-sys-color-outline: #79747E;
    --md-sys-color-outline-variant: #CAC4D0;
    
    --md-sys-color-background: #FFFBFE;
    --md-sys-color-on-background: #1C1B1F;
    
    --md-sys-color-shadow: #000000;
    
    /* Elevation */
    --md-elevation-level0: none;
    --md-elevation-level1: 0px 1px 2px 0px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-elevation-level2: 0px 1px 2px 0px rgba(0, 0, 0, 0.3), 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
    --md-elevation-level3: 0px 1px 3px 0px rgba(0, 0, 0, 0.3), 0px 4px 8px 3px rgba(0, 0, 0, 0.15);
    --md-elevation-level4: 0px 2px 3px 0px rgba(0, 0, 0, 0.3), 0px 6px 10px 4px rgba(0, 0, 0, 0.15);
    --md-elevation-level5: 0px 4px 4px 0px rgba(0, 0, 0, 0.3), 0px 8px 12px 6px rgba(0, 0, 0, 0.15);
    
    /* Shape */
    --md-shape-corner-none: 0px;
    --md-shape-corner-extra-small: 4px;
    --md-shape-corner-small: 8px;
    --md-shape-corner-medium: 12px;
    --md-shape-corner-large: 16px;
    --md-shape-corner-extra-large: 28px;
    
    /* State Layers */
    --md-state-hover-state-layer-opacity: 0.08;
    --md-state-focus-state-layer-opacity: 0.12;
    --md-state-pressed-state-layer-opacity: 0.12;
    --md-state-dragged-state-layer-opacity: 0.16;
}

/* Dark Theme Override (for darker background) */
[data-theme="dark"] {
    --md-sys-color-primary: #D0BCFF;
    --md-sys-color-on-primary: #381E72;
    --md-sys-color-primary-container: #4F378B;
    --md-sys-color-on-primary-container: #EADDFF;
    
    --md-sys-color-secondary: #CCC2DC;
    --md-sys-color-on-secondary: #332D41;
    --md-sys-color-secondary-container: #4A4458;
    --md-sys-color-on-secondary-container: #E8DEF8;
    
    --md-sys-color-surface: #1C1B1F;
    --md-sys-color-on-surface: #E6E1E5;
    --md-sys-color-surface-variant: #49454F;
    --md-sys-color-on-surface-variant: #CAC4D0;
    
    --md-sys-color-background: #1C1B1F;
    --md-sys-color-on-background: #E6E1E5;
}

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

html {
    overflow-x: hidden;
    overflow-y: auto;
    width: 100%;
    height: 100%;
    background: var(--md-sys-color-primary-container);
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background: transparent;
    color: var(--md-sys-color-on-background);
    min-height: 100vh;
    padding: 2rem;
    padding-bottom: 0;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    width: 100%;
    max-width: 100vw;
    margin: 0;
    -webkit-overflow-scrolling: touch;
}

/* Animated Background */
.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    min-width: 100%;
    min-height: 100%;
    z-index: -1;
    overflow: hidden;
    background: linear-gradient(135deg, 
        var(--md-sys-color-primary-container) 0%, 
        var(--md-sys-color-surface) 25%,
        var(--md-sys-color-secondary-container) 50%,
        var(--md-sys-color-surface) 75%,
        var(--md-sys-color-primary-container) 100%);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.background-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    background-image: 
        radial-gradient(circle at 20% 50%, var(--md-sys-color-primary) 2px, transparent 2px),
        radial-gradient(circle at 80% 80%, var(--md-sys-color-secondary) 2px, transparent 2px),
        radial-gradient(circle at 40% 20%, var(--md-sys-color-tertiary) 1.5px, transparent 1.5px);
    background-size: 60px 60px, 80px 80px, 100px 100px;
    animation: patternMove 30s linear infinite;
}

@keyframes patternMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(60px, 60px);
    }
}

.background-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--md-sys-color-primary), transparent);
    top: 10%;
    left: 10%;
    animation-duration: 25s;
    animation-delay: 0s;
}

.shape-2 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--md-sys-color-secondary), transparent);
    top: 60%;
    right: 15%;
    animation-duration: 30s;
    animation-delay: -5s;
}

.shape-3 {
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, var(--md-sys-color-tertiary), transparent);
    bottom: 20%;
    left: 20%;
    animation-duration: 22s;
    animation-delay: -10s;
}

.shape-4 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, var(--md-sys-color-primary), transparent);
    top: 50%;
    left: 50%;
    animation-duration: 28s;
    animation-delay: -15s;
}

.shape-5 {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, var(--md-sys-color-secondary), transparent);
    top: 80%;
    right: 30%;
    animation-duration: 24s;
    animation-delay: -8s;
}

.shape-6 {
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, var(--md-sys-color-tertiary), transparent);
    bottom: 10%;
    right: 10%;
    animation-duration: 32s;
    animation-delay: -12s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(30px, -30px) rotate(90deg);
    }
    50% {
        transform: translate(-20px, 40px) rotate(180deg);
    }
    75% {
        transform: translate(40px, 20px) rotate(270deg);
    }
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
}

/* Material Design 3 Typography */
.mdc-typography {
    font-family: 'Vazirmatn', sans-serif;
}

.mdc-typography--display-large {
    font-size: 3.5625rem;
    font-weight: 400;
    line-height: 4rem;
    letter-spacing: -0.015625rem;
}

.mdc-typography--display-medium {
    font-size: 2.8125rem;
    font-weight: 400;
    line-height: 3.25rem;
    letter-spacing: 0rem;
}

.mdc-typography--display-small {
    font-size: 2.25rem;
    font-weight: 400;
    line-height: 2.75rem;
    letter-spacing: 0rem;
}

.mdc-typography--headline1 {
    font-size: 2rem;
    font-weight: 400;
    line-height: 2.5rem;
    letter-spacing: 0rem;
}

.mdc-typography--headline2 {
    font-size: 1.75rem;
    font-weight: 400;
    line-height: 2.25rem;
    letter-spacing: 0rem;
}

.mdc-typography--headline3 {
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 2rem;
    letter-spacing: 0rem;
}

.mdc-typography--headline4 {
    font-size: 1.375rem;
    font-weight: 400;
    line-height: 1.75rem;
    letter-spacing: 0.009375rem;
}

.mdc-typography--headline5 {
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.5rem;
    letter-spacing: 0rem;
}

.mdc-typography--headline6 {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5rem;
    letter-spacing: 0.009375rem;
}

.mdc-typography--subtitle1 {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5rem;
    letter-spacing: 0.009375rem;
}

.mdc-typography--subtitle2 {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    letter-spacing: 0.00625rem;
}

.mdc-typography--body1 {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5rem;
    letter-spacing: 0.03125rem;
}

.mdc-typography--body2 {
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.25rem;
    letter-spacing: 0.015625rem;
}

.mdc-typography--button {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    letter-spacing: 0.02875rem;
    text-transform: uppercase;
}

.mdc-typography--caption {
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1rem;
    letter-spacing: 0.025rem;
}

.mdc-typography--overline {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1rem;
    letter-spacing: 0.0625rem;
    text-transform: uppercase;
}

/* Material Design 3 Card */
.mdc-card {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-shape-corner-large);
    box-shadow: var(--md-elevation-level1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.mdc-card:hover {
    box-shadow: var(--md-elevation-level3);
}

.mdc-card__content {
    padding: 1rem;
}

/* Material Design 3 Elevation */
.mdc-elevation--z0 {
    box-shadow: var(--md-elevation-level0);
}

.mdc-elevation--z1 {
    box-shadow: var(--md-elevation-level1);
}

.mdc-elevation--z2 {
    box-shadow: var(--md-elevation-level2);
}

.mdc-elevation--z3 {
    box-shadow: var(--md-elevation-level3);
}

.mdc-elevation--z4 {
    box-shadow: var(--md-elevation-level4);
}

.mdc-elevation--z5 {
    box-shadow: var(--md-elevation-level5);
}

/* Material Design 3 Chip */
.mdc-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0 12px;
    height: 32px;
    border: none;
    border-radius: var(--md-shape-corner-small);
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    letter-spacing: 0.00625rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.mdc-chip::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--md-sys-color-on-surface-variant);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mdc-chip:hover::before {
    opacity: var(--md-state-hover-state-layer-opacity);
}

.mdc-chip:focus {
    outline: none;
}

.mdc-chip:focus::before {
    opacity: var(--md-state-focus-state-layer-opacity);
}

.mdc-chip--selected {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.mdc-chip--completed {
    background-color: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
}

.mdc-chip--active {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* Header */
header {
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.title {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 2rem;
    font-weight: 500;
    line-height: 2.5rem;
    letter-spacing: -0.015625rem;
    color: var(--md-sys-color-primary);
    margin: 0;
    text-align: right;
}

.subtitle {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5rem;
    letter-spacing: 0rem;
    color: var(--md-sys-color-primary);
    margin: 0;
    text-align: left;
    direction: ltr;
}

/* Timer Section */
.timer-section {
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out;
}

.timer-section .mdc-card__content {
    padding: 2rem;
}

.timer-content-wrapper {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: nowrap;
    min-width: 0;
}

.timer {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
    direction: rtl;
    flex: 0 0 auto;
    flex-shrink: 0;
}

.timer-greeting {
    flex: 0 0 auto;
    text-align: right;
    flex-shrink: 0;
}

.greeting-text {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.8rem;
    color: var(--md-sys-color-primary);
    margin: 0;
}

.timer-message {
    flex: 1 1 auto;
    text-align: right;
    direction: rtl;
    min-width: 0;
    max-width: 100%;
}

.message-text {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.8rem;
    color: var(--md-sys-color-on-surface);
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
}

#taskName {
    font-weight: 600;
    color: var(--md-sys-color-primary);
    word-break: break-word;
    overflow-wrap: anywhere;
    display: inline-block;
    max-width: 100%;
}

.task-name-inline {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.timer-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--md-sys-color-surface-variant);
    padding: 1.5rem 1.5rem;
    border-radius: var(--md-shape-corner-medium);
    min-width: 100px;
    transition: all 0.2s ease;
}

.timer-unit:hover {
    box-shadow: var(--md-elevation-level4);
}

.timer-value {
    font-family: 'Vazirmatn', sans-serif;
    color: var(--md-sys-color-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    font-size: 2.5rem;
    font-weight: 700;
}

.timer-label {
    font-family: 'Vazirmatn', sans-serif;
    margin-top: 0.5rem;
    color: var(--md-sys-color-on-surface-variant);
}

.timer-separator {
    font-family: 'Vazirmatn', sans-serif;
    color: var(--md-sys-color-primary);
    animation: pulse 2s infinite;
}

.next-event {
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 1rem;
}

/* Timeline */
.timeline-container {
    position: relative;
    padding: 2rem 0;
}

.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--md-sys-color-outline-variant);
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    opacity: 0;
    animation: fadeInSlide 0.6s ease-out forwards;
}

.timeline-item:nth-child(odd) {
    flex-direction: row;
}

.timeline-item:nth-child(even) {
    flex-direction: row-reverse;
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.2s; }
.timeline-item:nth-child(3) { animation-delay: 0.3s; }
.timeline-item:nth-child(4) { animation-delay: 0.4s; }
.timeline-item:nth-child(5) { animation-delay: 0.5s; }
.timeline-item:nth-child(6) { animation-delay: 0.6s; }
.timeline-item:nth-child(7) { animation-delay: 0.7s; }
.timeline-item:nth-child(8) { animation-delay: 0.8s; }

.timeline-content {
    width: 45%;
    transition: all 0.2s ease;
    position: relative;
}

.timeline-content .mdc-card__content {
    padding: 1.5rem;
}

.timeline-content:hover {
    box-shadow: var(--md-elevation-level3);
}

.timeline-content.completed {
    background-color: #6750A4;
    color: #FFFFFF;
}

.timeline-content.active {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    box-shadow: var(--md-elevation-level4);
}

.timeline-dot {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--md-sys-color-surface);
    border: 3px solid var(--md-sys-color-outline-variant);
    box-shadow: var(--md-elevation-level2);
    z-index: 10;
    transition: all 0.3s ease;
}

.timeline-item.completed .timeline-dot {
    border-color: #6750A4;
    background-color: #6750A4;
}

.timeline-item.active .timeline-dot {
    border-color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-primary);
    animation: pulseDot 2s infinite;
}

.timeline-date {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5rem;
    letter-spacing: 0.009375rem;
    color: var(--md-sys-color-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-item.completed .timeline-date {
    color: #FFFFFF;
}

.timeline-item.active .timeline-date {
    color: var(--md-sys-color-on-primary-container);
}

.timeline-title {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 2rem;
    margin-bottom: 0.5rem;
    color: var(--md-sys-color-on-surface);
}

.timeline-content.completed .timeline-title {
    color: #FFFFFF;
}

.timeline-content.active .timeline-title {
    color: var(--md-sys-color-on-surface);
}

.timeline-description {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.25rem;
    letter-spacing: 0.015625rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 0.5rem;
}

.timeline-content.completed .timeline-description {
    color: #FFFFFF;
    opacity: 0.9;
}

.timeline-content.active .timeline-description {
    color: var(--md-sys-color-on-surface);
    opacity: 0.87;
}

.status-badge {
    margin-top: 0.75rem;
}

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

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

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

@keyframes pulseDot {
    0%, 100% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.2);
    }
}

/* Responsive */
@media (max-width: 768px) {
    html {
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
        min-height: 100%;
    }
    
    body {
        padding: 1rem;
        padding-bottom: 0;
        max-width: 100vw;
        min-height: 100vh;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    .animated-background {
        width: 100vw;
        min-width: 100vw;
        height: 100vh;
        min-height: 100vh;
    }

    .title {
        font-size: 2.25rem;
        line-height: 2.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .timer {
        gap: 0.25rem;
        flex-wrap: nowrap;
        justify-content: center;
    }

    .timer-unit {
        min-width: 60px;
        max-width: 80px;
        padding: 0.75rem 0.5rem;
        flex: 1 1 auto;
    }

    .timer-value {
        font-size: 1.75rem;
        line-height: 1.2;
        font-weight: 700;
    }

    .timer-separator {
        font-size: 1rem;
        line-height: 1.75rem;
        padding: 0 0.25rem;
    }

    .timer-label {
        font-size: 0.65rem;
    }

    .timer-section .mdc-card__content {
        padding: 1.5rem;
    }

    .timer-content-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }

    .timer-greeting,
    .timer-message {
        text-align: center;
        width: 100%;
    }

    .greeting-text,
    .message-text {
        font-size: 1.25rem;
        line-height: 1.6rem;
    }

    .timeline::before {
        left: 30px;
    }

    .timeline-item {
        flex-direction: row !important;
        padding-left: 60px;
    }

    .timeline-content {
        width: 100%;
    }

    .timeline-dot {
        left: 30px;
    }
    
    .footer {
        margin: 1rem -1rem 0 -1rem;
        width: calc(100% + 2rem);
    }
}

/* Footer */
.footer {
    background-color: var(--md-sys-color-primary-container);
    min-height: auto;
    padding: 0;
    margin: 2rem -2rem 0 -2rem;
    width: calc(100% + 4rem);
    text-align: center;
    max-width: 100vw;
    position: relative;
}

.footer-text {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    margin: 0;
    padding: 1rem 0;
}
