.pomodoro-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 40px 20px;
    transition: background 0.3s ease;
    background: #4b6cb7;  /* fallback for old browsers */
    background-image: url('/pomodoro/bgimage/bg-1.webp'), url('/pomodoro/bgimage/bg-1.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow-x: auto;
}

/* Поддержка safe-area для iOS (вырез камеры и нижняя зона) при использовании однотонного цвета */
.pomodoro-container--color {
    padding-top: max(40px, calc(40px + env(safe-area-inset-top)));
    padding-bottom: max(40px, calc(40px + env(safe-area-inset-bottom)));
}

.pomodoro-timer-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    width: 100%;
    position: relative;
}

.pomodoro-top-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
    margin-bottom: 10px;
}

.pomodoro-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    transition: all 0.3s ease;
    background: transparent;
}

.pomodoro-timer--break {
    /* Класс для перерыва, цвет применяется динамически */
}

.pomodoro-timer--running {
    /* Анимация пульсации убрана по запросу */
}

.pomodoro-timer__display {
    font-size: 112px;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: 2px;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    white-space: nowrap;
}

.pomodoro-timer__seconds {
    display: inline-block;
    min-width: 1.2em;
    text-align: left;
}

.pomodoro-timer__segment {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pomodoro-timer__mode {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 15px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pomodoro-fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.8);
}

.pomodoro-fullscreen-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.pomodoro-fullscreen-btn:hover {
    color: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.pomodoro-fullscreen-btn:active {
    transform: scale(0.95);
}

.pomodoro-exit-fullscreen-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    padding: 12px;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.8);
}

.pomodoro-exit-fullscreen-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.pomodoro-exit-fullscreen-btn:hover {
    color: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.pomodoro-exit-fullscreen-btn:active {
    transform: scale(0.95);
}

.pomodoro-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.pomodoro-settings-btn {
    background: none;
    border: none;
    color: #c3c3c3;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.3s ease;
    text-decoration: underline;
    text-decoration-style: dashed;
    text-decoration-color: #c3c3c3;
}

.pomodoro-settings-btn:hover {
    color: #a0a0a0;
    text-decoration-color: #a0a0a0;
}

.pomodoro-control-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.pomodoro-settings {
    margin-top: 20px;
    width: 100%;
    max-width: 400px;
    background: #fff;
    border: 1px solid #e6e4e4;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pomodoro-settings__content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pomodoro-settings__title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.pomodoro-settings__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pomodoro-settings__label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.pomodoro-settings__input,
.pomodoro-settings__select {
    padding: 10px;
    border: 1px solid #bebebe;
    border-radius: 5px;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
}

.pomodoro-settings__input:focus,
.pomodoro-settings__select:focus {
    outline: none;
    border-color: #0f0fff;
    box-shadow: 0 0 0 2px rgba(15, 15, 255, 0.1);
}

.pomodoro-settings__color-input {
    width: 100%;
    height: 50px;
    border: 1px solid #bebebe;
    border-radius: 5px;
    cursor: pointer;
    padding: 0;
    box-sizing: border-box;
}

.pomodoro-settings__color-input:focus {
    outline: none;
    border-color: #0f0fff;
    box-shadow: 0 0 0 2px rgba(15, 15, 255, 0.1);
}

.pomodoro-settings__checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0f0fff;
}

.pomodoro-background-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.pomodoro-background-option {
    width: 60px;
    height: 60px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.pomodoro-background-option:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pomodoro-background-option.pomodoro-background-option--selected {
    border-color: #ffd700;
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.3);
}

.pomodoro-background-option--color {
    background-color: #4b6cb7;
}

.pomodoro-color-picker-wrapper {
    position: relative;
    display: inline-block;
}

.pomodoro-color-picker-popup {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    min-width: 200px;
}

.pomodoro-color-picker-popup.pomodoro-color-picker-popup--visible {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pomodoro-color-picker-popup input[type="color"] {
    width: 100%;
    height: 50px;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    padding: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: none;
}

.pomodoro-color-picker-popup input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.pomodoro-color-picker-popup input[type="color"]::-webkit-color-swatch {
    border: 1px solid #ddd;
    border-radius: 5px;
}

.pomodoro-color-picker-popup input[type="color"]::-moz-color-swatch {
    border: 1px solid #ddd;
    border-radius: 5px;
}

.pomodoro-color-picker-btn {
    width: 100%;
    padding: 8px 16px;
    background-color: #42804f;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.pomodoro-color-picker-btn:hover {
    background-color: #4d9559;
}

.pomodoro-settings__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

.pomodoro-settings__actions .pomodoro-btn {
    min-width: 100px;
    padding: 10px 20px;
    font-size: 14px;
}

.pomodoro-tasks {
    margin-top: 20px;
    width: 100%;
    max-width: 800px;
    background: #fff;
    border: 1px solid #e6e4e4;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pomodoro-tasks__content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pomodoro-tasks__title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.pomodoro-tasks__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pomodoro-tasks__goals {
    display: flex;
    flex-direction: row;
    gap: 15px;
}

.pomodoro-tasks__goals .pomodoro-tasks__field {
    flex: 1;
}

.pomodoro-tasks__label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.pomodoro-tasks__input {
    padding: 10px;
    border: 1px solid #bebebe;
    border-radius: 5px;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
}

.pomodoro-tasks__input:focus {
    outline: none;
    border-color: #0f0fff;
    box-shadow: 0 0 0 2px rgba(15, 15, 255, 0.1);
}

.pomodoro-tasks__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

.pomodoro-tasks__actions .pomodoro-btn {
    min-width: 100px;
    padding: 10px 20px;
    font-size: 14px;
}

.pomodoro-tasks__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pomodoro-task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f8f8f8;
    border: 1px solid #e6e4e4;
    border-radius: 5px;
    gap: 10px;
}

.pomodoro-task-item--active {
    background: #e8f1f5;
    border-color: #0f0fff;
    border-width: 1px;
}

.pomodoro-task-item__name {
    flex: 1;
    font-size: 14px;
    color: #333;
    word-break: break-word;
}

.pomodoro-task-item__name--editable {
    cursor: pointer;
    transition: color 0.2s ease;
}

.pomodoro-task-item__name--editable:hover {
    color: #0f0fff;
    text-decoration: underline;
}

.pomodoro-task-item__counter {
    font-size: 12px;
    color: #666;
    padding: 0 10px;
    line-height: 1.4;
}

.pomodoro-task-item__buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pomodoro-task-item__select-btn {
    padding: 6px 16px;
    font-size: 12px;
    min-width: auto;
    white-space: nowrap;
    background: #e0e0e0;
    color: #666;
    border: 1px solid #ccc;
    transition: all 0.2s ease;
}

.pomodoro-task-item__select-btn:hover {
    background: linear-gradient(132.60036294847635deg, rgba(15, 15, 255,1) 34.0895190834999%,rgba(15, 15, 255,1) 35.26036333706644%,rgba(22, 28, 186,1) 74.23275063435236%);
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(15, 15, 255, 0.3);
}

.pomodoro-task-item__select-btn:active {
    transform: translateY(0);
}

.pomodoro-task-item__select-btn--selected {
    background: linear-gradient(132.60036294847635deg, rgba(15, 15, 255,1) 34.0895190834999%,rgba(15, 15, 255,1) 35.26036333706644%,rgba(22, 28, 186,1) 74.23275063435236%) !important;
    color: white !important;
    border: none !important;
}

.pomodoro-task-item__select-btn--selected:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(15, 15, 255, 0.3);
    background: linear-gradient(132.60036294847635deg, rgba(15, 15, 255,1) 34.0895190834999%,rgba(15, 15, 255,1) 35.26036333706644%,rgba(22, 28, 186,1) 74.23275063435236%) !important;
}

.pomodoro-task-item__delete-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 20px;
    line-height: 1;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 50%;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pomodoro-task-item__delete-spacer {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.pomodoro-task-item__delete-btn:hover {
    background: #ff4444;
    border-color: #ff4444;
    color: white;
}

.pomodoro-task-item__delete-btn:active {
    background: #cc0000;
    border-color: #cc0000;
}

.pomodoro-task-item__select-btn:hover {
    opacity: 0.9 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(15, 15, 255, 0.3);
    background: linear-gradient(132.60036294847635deg, rgba(15, 15, 255,1) 34.0895190834999%,rgba(15, 15, 255,1) 35.26036333706644%,rgba(22, 28, 186,1) 74.23275063435236%) !important;
}

.pomodoro-task-item__select-btn:active {
    opacity: 0.8 !important;
    transform: translateY(0);
    background: linear-gradient(132.60036294847635deg, rgba(15, 15, 255,1) 34.0895190834999%,rgba(15, 15, 255,1) 35.26036333706644%,rgba(22, 28, 186,1) 74.23275063435236%) !important;
}

#create-task-btn {
    background: linear-gradient(132.60036294847635deg, rgba(15, 15, 255,1) 34.0895190834999%,rgba(15, 15, 255,1) 35.26036333706644%,rgba(22, 28, 186,1) 74.23275063435236%) !important;
    color: white !important;
    border: none !important;
}

#create-task-btn:hover {
    opacity: 0.9 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 15, 255, 0.3);
    background: linear-gradient(132.60036294847635deg, rgba(15, 15, 255,1) 34.0895190834999%,rgba(15, 15, 255,1) 35.26036333706644%,rgba(22, 28, 186,1) 74.23275063435236%) !important;
}

#create-task-btn:active {
    opacity: 0.8 !important;
    transform: translateY(0);
    background: linear-gradient(132.60036294847635deg, rgba(15, 15, 255,1) 34.0895190834999%,rgba(15, 15, 255,1) 35.26036333706644%,rgba(22, 28, 186,1) 74.23275063435236%) !important;
}

.pomodoro-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pomodoro-btn--primary {
    background-color: #ffffff17;
    color: white;
    border: 1px solid white;
}

.pomodoro-btn--primary:hover {
    background-color: #42804f;
    transform: translateY(-2px);
    border: 1px solid #42804f;
    box-shadow: 0 4px 12px rgba(77, 149, 92, 0.3);
}

.pomodoro-btn--primary:active {
    background-color: #386a43;
    transform: translateY(0);
}

.pomodoro-btn--primary.pomodoro-btn--stop {
    background-color: #872323;
}

.pomodoro-btn--primary.pomodoro-btn--stop:hover {
    background-color: #dd3333;
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
}

.pomodoro-btn--primary.pomodoro-btn--stop:active {
    background-color: #bb2222;
}

.pomodoro-btn--green {
    background: linear-gradient(132.60036294847635deg, rgba(15, 15, 255,1) 34.0895190834999%,rgba(15, 15, 255,1) 35.26036333706644%,rgba(22, 28, 186,1) 74.23275063435236%);
    color: white;
    border: none;
}

.pomodoro-btn--green:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 15, 255, 0.3);
    background: linear-gradient(132.60036294847635deg, rgba(15, 15, 255,1) 34.0895190834999%,rgba(15, 15, 255,1) 35.26036333706644%,rgba(22, 28, 186,1) 74.23275063435236%);
}

.pomodoro-btn--green:active {
    opacity: 0.8;
    transform: translateY(0);
    background: linear-gradient(132.60036294847635deg, rgba(15, 15, 255,1) 34.0895190834999%,rgba(15, 15, 255,1) 35.26036333706644%,rgba(22, 28, 186,1) 74.23275063435236%);
}

.pomodoro-btn--secondary {
    background-color: #f5f5f5;
    color: #333;
    border: 2px solid #ddd;
}

.pomodoro-btn--secondary:hover {
    background-color: #e8e8e8;
    border-color: #bbb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pomodoro-btn--secondary:active {
    background-color: #ddd;
    transform: translateY(0);
}

.pomodoro-tasks__delete-btn {
    background: none;
    border: none;
    color: #c3c3c3;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.3s ease;
    text-decoration: underline;
    text-decoration-style: dashed;
    text-decoration-color: #c3c3c3;
    margin-top: 20px;
    display: inline-block;
    align-self: center;
}

.pomodoro-tasks__delete-btn:hover {
    color: #a0a0a0;
    text-decoration-color: #a0a0a0;
}

.pomodoro-btn--small {
    padding: 8px 20px;
    font-size: 14px;
    min-width: auto;
}

/* Полноэкранный режим */
.pomodoro-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeInFullscreen 0.3s ease-out;
    transition: background 0.3s ease;
    background: #4b6cb7;  /* fallback for old browsers */
    background-image: url('/pomodoro/bgimage/bg-1.webp'), url('/pomodoro/bgimage/bg-1.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

/* Поддержка safe-area для iOS в полноэкранном режиме при использовании однотонного цвета */
.pomodoro-fullscreen--color {
    padding-top: max(20px, calc(20px + env(safe-area-inset-top)));
    padding-bottom: max(20px, calc(20px + env(safe-area-inset-bottom)));
    padding-left: max(20px, calc(20px + env(safe-area-inset-left)));
    padding-right: max(20px, calc(20px + env(safe-area-inset-right)));
}

.pomodoro-fullscreen.pomodoro-fullscreen--break {
    /* Цвет фона для перерыва будет применяться динамически через JavaScript */
}

.pomodoro-fullscreen .pomodoro-timer {
    width: 90%;
    transform: scale(1.2);
}

.pomodoro-fullscreen .pomodoro-timer__display {
    font-size: 120px;
}

.pomodoro-fullscreen .pomodoro-timer__segment {
    font-size: 24px;
}

.pomodoro-fullscreen .pomodoro-timer__mode {
    font-size: 28px;
}

.pomodoro-fullscreen .pomodoro-controls {
    margin-top: 40px;
}

.pomodoro-fullscreen .pomodoro-btn {
    padding: 15px 40px;
    font-size: 18px;
    min-width: 160px;
}

html.pomodoro-fullscreen-active,
body.pomodoro-fullscreen-active {
    overflow: hidden !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Скрываем основные элементы страницы в полноэкранном режиме */
body.pomodoro-fullscreen-active > header,
body.pomodoro-fullscreen-active > nav,
body.pomodoro-fullscreen-active .breadcrumbs__wrapper,
body.pomodoro-fullscreen-active > main > section:not(.pomodoro-fullscreen),
body.pomodoro-fullscreen-active > main > footer {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

@keyframes fadeInFullscreen {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Адаптивность */
@media (max-width: 600px) {
    .pomodoro-task-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pomodoro-task-item__name {
        width: 100%;
    }
    
    .pomodoro-task-item__buttons {
        width: 100%;
        justify-content: space-between;
    }
    
    .pomodoro-tasks__goals {
        flex-direction: column;
        gap: 0;
    }
    
    .pomodoro-tasks__goals .pomodoro-tasks__field {
        flex: none;
    }
}

@media (max-width: 768px) {
    .pomodoro-timer__display {
        font-size: 56px;
    }
    
    .pomodoro-timer__mode {
        font-size: 16px;
    }
    
    .pomodoro-btn {
        padding: 10px 25px;
        font-size: 14px;
        min-width: 120px;
    }
    
    .pomodoro-fullscreen-btn {
        top: 5px;
        right: 5px;
        padding: 8px;
    }
    
    .pomodoro-fullscreen-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .pomodoro-exit-fullscreen-btn {
        top: 10px;
        right: 10px;
        padding: 10px;
    }
    
    .pomodoro-exit-fullscreen-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .pomodoro-fullscreen .pomodoro-timer {
        transform: scale(1.1);
    }
    
    .pomodoro-fullscreen .pomodoro-timer__display {
        font-size: 80px;
    }
    
    .pomodoro-fullscreen .pomodoro-timer__mode {
        font-size: 22px;
    }
}

@media (max-width: 500px) {
    .pomodoro-settings__actions {
        flex-direction: column;
    }
    
    .pomodoro-settings__actions .pomodoro-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .pomodoro-timer__display {
        font-size: 48px;
    }
    
    .pomodoro-timer__mode {
        font-size: 14px;
    }
    
    .pomodoro-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .pomodoro-btn {
        width: 100%;
    }
    
    .pomodoro-fullscreen .pomodoro-timer__display {
        font-size: 64px;
    }
    
    .pomodoro-fullscreen .pomodoro-timer__mode {
        font-size: 18px;
    }
}
