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

:root {
    --primary-color: #059669;
    --primary-hover: #047857;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #059669 0%, #0d9488 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.dashboard-header {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
}

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

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.dashboard-header h1 {
    color: var(--primary-color);
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

/* Live Clock */
.live-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #059669 0%, #0d9488 100%);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    min-width: 200px;
}

.clock-time {
    font-size: 32px;
    font-weight: 700;
    color: white;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    line-height: 1;
}

.clock-date {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-primary);
    border-radius: 20px;
    font-size: 14px;
}

.connection-status.connected i {
    color: var(--success-color);
    animation: pulse 2s infinite;
}

.connection-status.disconnected i {
    color: var(--danger-color);
}

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

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

/* Task Sections */
.tasks-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.task-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.daily-section .section-header h2 { color: #059669; }
.monthly-section .section-header h2 { color: #0d9488; }
.yearly-section .section-header h2 { color: #14b8a6; }

.task-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
    scroll-behavior: smooth;
}

.task-list::-webkit-scrollbar {
    width: 6px;
}

.task-list::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 10px;
}

.task-list::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 10px;
}

.task-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Task Items */
.task-item {
    background: var(--bg-primary);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.task-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.task-item.status-pending { border-left-color: #f59e0b; }
.task-item.status-in-progress { border-left-color: #059669; }
.task-item.status-completed { border-left-color: #10b981; }

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.task-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recurring-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #059669 0%, #0d9488 100%);
    color: white;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.recurring-badge i {
    font-size: 10px;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

.task-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.task-actions button:hover {
    background: rgba(5, 150, 105, 0.1);
}

.task-actions .btn-edit { color: var(--primary-color); }
.task-actions .btn-delete { color: var(--danger-color); }

.task-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.task-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

.task-meta i {
    margin-right: 4px;
}

.task-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.task-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.task-status.in-progress {
    background: #d1fae5;
    color: #065f46;
}

.task-status.completed {
    background: #a7f3d0;
    color: #047857;
}

/* Calendar Widget */
.calendar-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.calendar-widget {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
}

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

.calendar-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day-header {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 0;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.calendar-day:hover {
    background: var(--bg-primary);
}

.calendar-day.today {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.calendar-day.has-tasks::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    background: var(--danger-color);
    border-radius: 50%;
}

.calendar-day.other-month {
    color: var(--text-secondary);
    opacity: 0.3;
}

/* Statistics Card */
.stats-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
}

.stats-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.stat-item {
    background: linear-gradient(135deg, #059669 0%, #0d9488 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

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

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: var(--bg-secondary);
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease;
}

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

.modal-small {
    max-width: 400px;
}

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

.modal-header h2 {
    font-size: 22px;
    font-weight: 600;
}

.close {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--text-primary);
}

.modal-content form {
    padding: 30px;
}

.modal-content p {
    padding: 20px 30px;
    color: var(--text-secondary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .calendar-column {
        order: -1;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .dashboard-header {
        padding: 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        width: 100%;
    }

    .dashboard-header h1 {
        font-size: 22px;
    }

    .live-clock {
        width: 100%;
        padding: 10px 15px;
    }

    .clock-time {
        font-size: 28px;
    }

    .clock-date {
        font-size: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .task-list {
        max-height: 250px;
    }
}

/* Countdown Banner */
.countdown-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    animation: flashBanner 1.5s ease-in-out infinite;
}

@keyframes flashBanner {
    0%, 100% {
        background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
        opacity: 1;
    }
    50% {
        background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
        opacity: 0.9;
    }
}

.banner-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    font-weight: 600;
}

.banner-icon {
    font-size: 24px;
}

.banner-event-counter {
    background: rgba(255, 255, 255, 0.3);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.banner-task-name {
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.banner-countdown {
    font-size: 28px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    padding: 5px 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    min-width: 150px;
}

.banner-time-range {
    font-size: 14px;
    opacity: 0.95;
}

body.has-countdown-banner {
    padding-top: 80px !important;
}

body.has-countdown-banner .container {
    margin-top: 0;
}

/* Banner Sound Toggle Button */
.banner-sound-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.banner-sound-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.banner-sound-toggle.muted {
    opacity: 0.6;
}

/* TTS Speak Button */
.btn-speak {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 10px;
    transition: all 0.3s ease;
}

.btn-speak:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-speak i {
    margin-right: 4px;
}
