/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #ba4949 0%, #a13d3d 100%);
    min-height: 100vh;
    color: #333;
    transition: background 0.3s ease;
}

body.short-break {
    background: linear-gradient(135deg, #38858a 0%, #2d6b6f 100%);
}

body.long-break {
    background: linear-gradient(135deg, #375471 0%, #2a4159 100%);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    color: white;
}

.logo {
    font-size: 24px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo a {
    color: white;
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-menu {
    display: flex;
    gap: 10px;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.username {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.role-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.role-guest { background: #9e9e9e; color: white; }
.role-normal { background: #e0e0e0; color: #333; }
.role-monthly_vip { background: #ffd700; color: #333; }
.role-yearly_vip { background: #ff9800; color: white; }

.btn-auth-small {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-auth-small:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-register {
    background: rgba(255, 255, 255, 0.35);
}

.btn-register:hover {
    background: rgba(255, 255, 255, 0.45);
}

.language-switcher select {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.language-switcher select:hover {
    background: rgba(255, 255, 255, 0.3);
}

.language-switcher select option {
    background: #ba4949;
    color: white;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Timer Section */
.timer-section {
    background: white;
    border-radius: 12px;
    padding: 40px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.timer-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

.tab-btn:hover {
    background: #f5f5f5;
}

.tab-btn.active {
    background: #ba4949;
    color: white;
}

body.short-break .tab-btn.active {
    background: #38858a;
}

body.long-break .tab-btn.active {
    background: #375471;
}

.timer-display {
    text-align: center;
    margin-bottom: 30px;
}

.timer {
    font-size: 120px;
    font-weight: 300;
    color: #333;
    letter-spacing: -2px;
    font-variant-numeric: tabular-nums;
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.btn-primary {
    background: #ba4949;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 8px rgba(186, 73, 73, 0.3);
}

.btn-primary:hover {
    background: #a13d3d;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(186, 73, 73, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

body.short-break .btn-primary {
    background: #38858a;
    box-shadow: 0 4px 8px rgba(56, 133, 138, 0.3);
}

body.short-break .btn-primary:hover {
    background: #2d6b6f;
    box-shadow: 0 6px 12px rgba(56, 133, 138, 0.4);
}

body.long-break .btn-primary {
    background: #375471;
    box-shadow: 0 4px 8px rgba(55, 84, 113, 0.3);
}

body.long-break .btn-primary:hover {
    background: #2a4159;
    box-shadow: 0 6px 12px rgba(55, 84, 113, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #666;
    border: none;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-small {
    padding: 10px 20px;
    font-size: 14px;
}

.btn-text {
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.btn-text:hover {
    color: #333;
}

.pomodoro-counter {
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Tasks Section */
.tasks-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.tasks-header h2 {
    font-size: 20px;
    color: #333;
}

.task-input-container {
    margin-bottom: 20px;
}

.task-input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.task-input:focus {
    outline: none;
    border-color: #ba4949;
}

body.short-break .task-input:focus {
    border-color: #38858a;
}

body.long-break .task-input:focus {
    border-color: #375471;
}

.task-input-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

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

.estimate-input label {
    font-size: 14px;
    color: #666;
}

.estimate-input input {
    width: 60px;
    padding: 8px;
    font-size: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
}

.estimate-input input:focus {
    outline: none;
    border-color: #ba4949;
}

.tasks-list {
    min-height: 100px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.task-item {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s;
}

.task-item:hover {
    background: #f0f0f0;
}

.task-item.active {
    border-left: 4px solid #ba4949;
    background: #fff5f5;
}

body.short-break .task-item.active {
    border-left-color: #38858a;
    background: #f0f8f8;
}

body.long-break .task-item.active {
    border-left-color: #375471;
    background: #f0f4f8;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.task-content {
    flex: 1;
}

.task-title {
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.task-item.completed .task-title {
    text-decoration: line-through;
    color: #999;
}

.task-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #666;
}

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

.task-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.task-btn:hover {
    color: #333;
}

.task-btn.delete:hover {
    color: #e74c3c;
}

.estimated-finish-time {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Stats Section */
.stats-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.stats-header {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stats-header h1 {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
}

.stats-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    flex-wrap: wrap;
}

.stats-tab {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    transition: all 0.2s;
}

.stats-tab:hover {
    background: #f5f5f5;
}

.stats-tab.active {
    background: #ba4949;
    color: white;
}

body.short-break .stats-tab.active {
    background: #38858a;
}

body.long-break .stats-tab.active {
    background: #375471;
}

.period-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.period-tab {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-decoration: none;
    color: #666;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.period-tab:hover {
    border-color: #ba4949;
    color: #ba4949;
}

.period-tab.active {
    background: #ba4949;
    border-color: #ba4949;
    color: white;
}

body.short-break .period-tab:hover {
    border-color: #38858a;
    color: #38858a;
}

body.short-break .period-tab.active {
    background: #38858a;
    border-color: #38858a;
}

body.long-break .period-tab:hover {
    border-color: #375471;
    color: #375471;
}

body.long-break .period-tab.active {
    background: #375471;
    border-color: #375471;
}

.period-tab.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.lock-mini {
    vertical-align: middle;
}

.stats-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stats-card h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
}

.chart-container {
    position: relative;
    height: 300px;
    margin-top: 20px;
}

.locked-message {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.lock-icon {
    margin-bottom: 15px;
}

.records-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.records-table th,
.records-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.records-table th {
    color: #666;
    font-weight: 600;
    background: #f9f9f9;
}

.records-table .empty-cell {
    text-align: center;
    color: #999;
    padding: 40px;
}

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

.date-picker input {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: #666;
    border: 1px solid #e0e0e0;
}

.pagination a:hover {
    background: #f5f5f5;
}

.pagination .current {
    background: #ba4949;
    color: white;
    border-color: #ba4949;
}

.guest-notice {
    background: #fff8e1;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
    color: #856404;
}

/* About Section */
.about-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-top: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.about-section h2 {
    font-size: 22px;
    color: #333;
    margin-bottom: 15px;
}

.about-section h3 {
    font-size: 18px;
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
}

.about-section p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.about-section ol {
    color: #666;
    line-height: 1.8;
    padding-left: 20px;
}

.about-section li {
    margin-bottom: 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    font-size: 22px;
    color: #333;
}

.btn-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.btn-close:hover {
    color: #333;
}

.modal-body {
    padding: 30px;
}

.settings-group {
    margin-bottom: 30px;
}

.settings-group h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.setting-item label {
    flex: 1;
    font-size: 14px;
    color: #666;
}

.setting-item input[type="number"] {
    width: 80px;
    padding: 8px;
    font-size: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
}

.setting-item input[type="number"]:focus {
    outline: none;
    border-color: #ba4949;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.setting-item span {
    font-size: 13px;
    color: #999;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
    text-align: right;
}

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

    .header {
        flex-direction: column;
        gap: 15px;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-menu {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .user-menu {
        order: 2;
    }

    .user-info {
        align-items: center;
    }

    .timer {
        font-size: 80px;
    }

    .timer-section {
        padding: 30px 20px;
    }

    .tasks-section {
        padding: 20px;
    }

    .task-input-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .estimate-input {
        justify-content: space-between;
    }

    .modal-content {
        width: 95%;
    }

    .setting-item {
        flex-wrap: wrap;
    }

    .setting-item label {
        flex: 1 1 100%;
    }

    .stats-container {
        padding: 15px;
    }

    .stats-header {
        padding: 20px;
    }

    .stats-tabs {
        gap: 8px;
    }

    .stats-tab {
        padding: 8px 14px;
        font-size: 14px;
    }

    .chart-container {
        height: 240px;
    }

    .records-table th,
    .records-table td {
        padding: 10px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .timer {
        font-size: 60px;
    }

    .timer-tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
    }

    .btn-primary {
        width: 100%;
    }
}
