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

:root {
    --primary-color: #1fa2ed;
    --primary-dark: #0d8dd6;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --success-color: #00c853;
    --danger-color: #f44336;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
    padding-bottom: 88px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.back-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.page-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.add-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(31, 162, 237, 0.3);
}

.add-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.placeholder {
    width: 40px;
}

.main-content {
    padding: 8px 0 24px;
}

.timer-switch-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    overflow: hidden;
}

.switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}

.switch-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.switch-label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.switch-desc {
    font-size: 12px;
    color: var(--text-light);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 32px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e0e0e0;
    transition: 0.3s;
    border-radius: 32px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

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

.timer-on-config {
    border-top: 1px solid #f0f0f0;
    padding: 16px 20px;
}

.config-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.config-tab {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.config-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.config-tab:hover:not(.active) {
    background: #f5f5f5;
}

.time-picker {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.time-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-input {
    width: 64px;
    height: 56px;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md);
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

.time-input:focus {
    border-color: var(--primary-color);
}

.time-separator {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.date-picker {
    margin-bottom: 12px;
}

.date-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md);
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

.date-input:focus {
    border-color: var(--primary-color);
}

.week-picker {
    margin-top: 12px;
}

.week-days {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.week-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.week-day input[type="checkbox"] {
    display: none;
}

.week-day span {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.week-day input[type="checkbox"]:checked + span {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.timer-list-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 16px 20px;
}

.section-header {
    margin-bottom: 16px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.timer-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    color: var(--text-light);
}

.empty-state svg {
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 14px;
}

.footer-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-around;
    max-width: 600px;
    margin: 0 auto;
    z-index: 100;
}

.footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-light);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 4px 16px;
}

.footer-item.active {
    color: var(--primary-color);
}

.footer-item svg {
    width: 24px;
    height: 24px;
}

.timer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fafafa;
    border-radius: var(--radius-md);
}

.timer-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timer-item-time {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.timer-item-type {
    font-size: 12px;
    color: var(--text-light);
}

.timer-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-item-switch {
    position: relative;
    width: 44px;
    height: 26px;
}

.timer-item-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.timer-item-switch .toggle-slider {
    width: 44px;
    height: 26px;
    background-color: #e0e0e0;
}

.timer-item-switch .toggle-slider:before {
    height: 22px;
    width: 22px;
}

.timer-item-switch input:checked + .toggle-slider {
    background-color: var(--success-color);
}

.timer-item-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

.delete-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.delete-btn:hover {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger-color);
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .page-title {
        font-size: 16px;
    }

    .time-input {
        width: 56px;
        height: 48px;
        font-size: 20px;
    }

    .week-days {
        justify-content: flex-start;
    }

    .week-day span {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: flex-end;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.timer-select-modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 600px;
    padding: 20px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.timer-config-modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    animation: slideUp 0.3s ease;
}

.timer-config-modal .modal-content {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.timer-config-modal .modal-content > * {
    width: 100%;
}

.timer-config-modal .modal-content .config-date-picker,
.timer-config-modal .modal-content .config-actions {
    width: auto;
    flex: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}

.modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.modal-header .save-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.modal-header .save-btn:hover {
    background: var(--primary-dark);
}

.modal-header .save-btn:active {
    transform: scale(0.98);
}

.back-to-list {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.back-to-list:hover {
    background: rgba(0, 0, 0, 0.05);
}

.timer-type-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px;
    background: #fafafa;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.timer-type-btn:last-child {
    margin-bottom: 0;
}

.timer-type-btn:hover {
    background: #f0f0f0;
}

.timer-type-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 16px;
}

.timer-type-icon.power-on {
    background: rgba(0, 200, 83, 0.1);
    color: var(--success-color);
}

.timer-type-icon.power-off {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger-color);
}

.timer-type-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.timer-type-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.timer-type-desc {
    font-size: 12px;
    color: var(--text-light);
}

.arrow-icon {
    color: var(--text-light);
}

.config-type-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.config-tab {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.config-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.config-tab:hover:not(.active) {
    background: #f5f5f5;
}

.config-time-picker {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.scroll-picker-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.scroll-picker {
    position: relative;
    width: 70px;
    height: 180px;
    overflow: hidden;
    background: #f5f5f5;
    border-radius: var(--radius-md);
}

.scroll-wrapper {
    height: 100%;
    overflow-y: scroll;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.scroll-wrapper::-webkit-scrollbar {
    display: none;
}

.scroll-content {
    padding: 60px 0;
}

.scroll-item {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.2s ease;
}

.scroll-item.empty {
    height: 60px;
}

.scroll-item.selected {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.scroll-indicator {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 60px;
    transform: translateY(-50%);
    pointer-events: none;
    border-top: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    background: rgba(31, 162, 237, 0.05);
}

.picker-separator {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 4px;
}

.picker-label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.config-date-picker {
    margin-bottom: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.config-date-picker .date-input {
    width: 100%;
    padding: 14px;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md);
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

.config-date-picker .date-input:focus {
    border-color: var(--primary-color);
}

.config-week-picker {
    margin-bottom: 20px;
}

.config-week-picker .week-days {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

.config-week-picker .week-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.config-week-picker .week-day input[type="checkbox"] {
    display: none;
}

.config-week-picker .week-day span {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.config-week-picker .week-day input[type="checkbox"]:checked + span {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.config-actions {
    margin-top: 0;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.save-btn {
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.save-btn:hover {
    background: var(--primary-dark);
}

.save-btn:active {
    transform: scale(0.98);
}
