/* DayStreak - Dark Theme Styles */
/* Mobile-First Design — Matches screenshot card format */

/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #141428;
    --bg-card: #1a1a35;
    --bg-input: #141428;
    --bg-hover: #22224a;
    --text-primary: #f0f0ff;
    --text-secondary: #a0a0cc;
    --text-muted: #6666aa;
    --accent: #8b5cf6;
    --accent-light: #c084fc;
    --accent-gradient: linear-gradient(135deg, #8b5cf6, #c084fc, #e879f9);
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --border: #2d2d55;
    --shadow: 0 8px 32px rgba(139, 92, 246, 0.15);
    --glow: 0 0 20px rgba(139, 92, 246, 0.2);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.25s ease;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, #0a0a1a 0%, #0f0f2a 50%, #0a0a1a 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: var(--accent-light);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent);
}

/* ===== App Container ===== */
.app-container {
    max-width: 420px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 0 12px;
    position: relative;
}

/* ===== Date Navigation ===== */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 4px 8px;
}

.date-nav-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(139, 92, 246, 0.25);
    background: linear-gradient(145deg, #1a1a35, #1e1e40);
    color: var(--accent-light);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.date-nav-btn:hover {
    background: linear-gradient(145deg, #22224a, #2a2a55);
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.25);
}

.date-nav-center {
    text-align: center;
}

.date-nav-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.date-today-link {
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 16px;
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-light);
    font-weight: 600;
}

/* ===== Main Day Card (Screenshot Style) ===== */
.day-card-main {
    background: linear-gradient(145deg, #1a1a35, #1e1e40);
    border-radius: var(--radius);
    margin: 8px 0 16px;
    box-shadow: var(--shadow), var(--glow);
    border: 1px solid rgba(139, 92, 246, 0.2);
    overflow: hidden;
    position: relative;
}

.day-card-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
}

/* Card Header */
.day-card-header {
    text-align: center;
    padding: 28px 20px 18px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.06) 0%, transparent 100%);
}

.day-card-title {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
}

.day-card-label {
    font-size: 0.8rem;
    color: var(--accent-light);
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: 700;
    opacity: 0.8;
}

.day-card-num {
    font-size: 3.2rem;
    font-weight: 900;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.4));
}

.day-card-sep {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: 300;
}

.day-card-total {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.day-card-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
    letter-spacing: 0.5px;
}

/* Task Table */
.task-table {
    width: 100%;
    border-collapse: collapse;
}

.task-table thead th {
    padding: 12px 12px;
    font-size: 0.7rem;
    color: var(--accent-light);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    text-align: left;
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
    background: rgba(139, 92, 246, 0.05);
}

.task-table thead th.col-no {
    width: 36px;
    text-align: center;
}

.task-table thead th.col-status {
    width: 56px;
    text-align: center;
}

.task-table thead th.col-note {
    width: 90px;
}

.task-table tbody tr {
    border-bottom: 1px solid rgba(139, 92, 246, 0.08);
    transition: var(--transition);
}

.task-table tbody tr:last-child {
    border-bottom: none;
}

.task-table tbody tr:hover {
    background: rgba(139, 92, 246, 0.06);
}

.task-table tbody td {
    padding: 14px 12px;
    vertical-align: middle;
}

.task-table tbody td.col-no {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 700;
}

.task-table tbody td.col-task {
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.task-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.task-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.task-table tbody td.col-status {
    text-align: center;
}

.task-status {
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    display: inline-block;
}

.task-status:hover {
    transform: scale(1.3);
    filter: drop-shadow(0 0 6px currentColor);
}

.task-status.done { color: var(--success); filter: drop-shadow(0 0 4px rgba(52, 211, 153, 0.4)); }
.task-status.missed { color: var(--danger); }
.task-status.partial { color: var(--warning); filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.4)); }

.task-table tbody td.col-note {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.task-note {
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 6px;
    transition: var(--transition);
    display: inline-block;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-note:hover {
    background: var(--bg-secondary);
}

.task-note.editing {
    background: var(--bg-input);
    border: 1px solid var(--accent);
    max-width: 100%;
}

.task-note input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.75rem;
    width: 100%;
    outline: none;
}

/* Card Footer */
.day-card-footer {
    padding: 18px 20px;
    text-align: center;
    border-top: 1px solid rgba(139, 92, 246, 0.15);
    background: linear-gradient(180deg, transparent 0%, rgba(139, 92, 246, 0.04) 100%);
}

.day-card-quote {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.5;
}

.day-card-badge {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 22px;
    background: var(--accent-gradient);
    border-radius: 24px;
    font-size: 0.72rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.35);
}

/* Streak Info */
.streak-info {
    text-align: center;
    font-size: 0.82rem;
    color: var(--danger);
    font-weight: 700;
    margin-bottom: 12px;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.1), rgba(239, 68, 68, 0.05));
    border-radius: var(--radius-sm);
    border: 1px solid rgba(248, 113, 113, 0.15);
    letter-spacing: 0.3px;
}

/* ===== Progress Bar ===== */
.progress-section {
    background: linear-gradient(145deg, #1a1a35, #1e1e40);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin-bottom: 16px;
    border: 1px solid rgba(139, 92, 246, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-header .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.progress-header .value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-light);
}

.progress-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.5s ease;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* ===== Auth Pages ===== */
.auth-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    padding: 20px 0;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.auth-card .auth-title {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-card .auth-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
}

/* ===== App Header (Logo) ===== */
.app-header {
    padding: 20px 0 8px;
    text-align: center;
}

.app-logo {
    font-size: 1.6rem;
    font-weight: 900;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.app-logo .emoji {
    -webkit-text-fill-color: initial;
    filter: drop-shadow(0 0 8px rgba(255, 100, 50, 0.5));
}

.app-tagline {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-style: italic;
    letter-spacing: 0.5px;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888aa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.form-check label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    width: 100%;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-2px);
    color: white;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.45);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
    width: auto;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    font-size: 1rem;
    width: auto;
}

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #141428, #0f0f22);
    border-top: 1px solid rgba(139, 92, 246, 0.15);
    display: flex;
    justify-content: center;
    z-index: 100;
    padding: 0;
    backdrop-filter: blur(10px);
}

.bottom-nav .nav-inner {
    display: flex;
    max-width: 420px;
    width: 100%;
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.bottom-nav a .nav-icon {
    font-size: 1.3rem;
    margin-bottom: 2px;
}

.bottom-nav a.active {
    color: var(--accent-light);
}

.bottom-nav a:hover {
    color: var(--accent-light);
}

/* ===== Habit Management ===== */
.habit-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.habit-item {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.habit-item:hover {
    border-color: var(--accent);
}

.habit-item .habit-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.habit-item .habit-info {
    flex: 1;
    min-width: 0;
}

.habit-item .habit-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.habit-item .habit-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.habit-item .habit-actions {
    display: flex;
    gap: 6px;
}

/* ===== Setup Page ===== */
.setup-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.setup-card h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.duration-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.duration-option {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.duration-option:hover {
    border-color: var(--accent);
}

.duration-option.selected {
    border-color: var(--accent);
    background: rgba(124, 58, 237, 0.1);
}

.duration-option .days {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-light);
}

.duration-option .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Analytics ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ===== Heatmap ===== */
.heatmap {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.heatmap h3 {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    background: var(--bg-secondary);
}

.heatmap-cell.level-1 { background: rgba(124, 58, 237, 0.2); }
.heatmap-cell.level-2 { background: rgba(124, 58, 237, 0.4); }
.heatmap-cell.level-3 { background: rgba(124, 58, 237, 0.6); }
.heatmap-cell.level-4 { background: rgba(124, 58, 237, 0.8); }

/* ===== Profile ===== */
.profile-header {
    text-align: center;
    padding: 20px 0;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 12px;
}

.profile-name {
    font-size: 1.3rem;
    font-weight: 700;
}

.profile-email {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 380px;
    border: 1px solid var(--border);
    transform: translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
}

/* ===== Page Title ===== */
.page-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-10 { margin-top: 10px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.gap-10 { gap: 10px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ===== Padding for bottom nav ===== */
.page-content {
    padding-bottom: 70px;
}

/* ===== Loading Spinner ===== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Toast Notification ===== */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    z-index: 300;
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

/* ===== Responsive ===== */
@media (min-width: 421px) {
    .app-container {
        padding: 0 24px;
    }
}
