/* Habita - Web Application Styles */

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

:root {
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-light: #f9fafb;
    --bg-dark: #1f2937;
    --text-light: #111827;
    --text-dark: #f3f4f6;
    --border-light: #e5e7eb;
    --border-dark: #374151;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-light);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
    background-color: var(--bg-dark);
    color: var(--text-dark);
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.app-title {
    font-size: 1.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-stats {
    display: flex;
    gap: 2rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

/* Navigation Tabs */
.tab-navigation {
    display: flex;
    gap: 0;
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

body.dark-mode .tab-navigation {
    background-color: var(--bg-dark);
    border-bottom-color: var(--border-dark);
}

.tab-button {
    flex: 1;
    min-width: 100px;
    padding: 1rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.3s;
}

body.dark-mode .tab-button {
    color: var(--text-dark);
}

.tab-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

body.dark-mode .tab-button:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-button i {
    font-size: 1.2rem;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
}

.tab-content {
    animation: fadeIn 0.3s ease-in;
}

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

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.view-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background-color: var(--border-light);
    color: var(--text-light);
}

body.dark-mode .btn-secondary {
    background-color: var(--border-dark);
    color: var(--text-dark);
}

.btn-secondary:hover {
    opacity: 0.8;
}

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

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

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.8rem 2rem;
    font-size: 1.05rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #9ca3af;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.empty-state small {
    display: block;
    font-size: 0.9rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 0.5rem;
    font-size: 1rem;
    background-color: white;
    color: var(--text-light);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea {
    background-color: var(--bg-dark);
    color: var(--text-dark);
    border-color: var(--border-dark);
}

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

/* Color Picker */
.color-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--text-light);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--text-light);
}

body.dark-mode .color-option.selected {
    border-color: var(--text-dark);
    box-shadow: 0 0 0 2px var(--bg-dark), 0 0 0 4px var(--text-dark);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-in;
}

.modal-content {
    background-color: var(--bg-light);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

body.dark-mode .modal-content {
    background-color: var(--bg-dark);
}

@keyframes slideUp {
    from {
        transform: translateY(2rem);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

body.dark-mode .modal-header {
    border-bottom-color: var(--border-dark);
}

.modal-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    padding: 0;
}

body.dark-mode .close-btn {
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-light);
}

body.dark-mode .modal-footer {
    border-top-color: var(--border-dark);
}

/* Onboarding */
.onboarding-content {
    max-width: 600px;
    padding: 3rem 2rem;
    text-align: center;
}

.onboarding-page {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

#onboarding-pages > div:first-child {
    display: block;
}

.onboarding-graphic {
    font-size: 4rem;
    margin-bottom: 2rem;
    color: var(--primary);
}

.onboarding-page h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.onboarding-page p {
    font-size: 1rem;
    color: #6b7280;
    margin-bottom: 2rem;
    line-height: 1.6;
}

body.dark-mode .onboarding-page p {
    color: #9ca3af;
}

/* Task List */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.task-card {
    background-color: white;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark-mode .task-card {
    background-color: rgba(255, 255, 255, 0.05);
}

.task-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.task-card-content {
    flex: 1;
}

.task-title {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.task-meta {
    font-size: 0.85rem;
    color: #6b7280;
}

body.dark-mode .task-meta {
    color: #9ca3af;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
}

/* Ike Matrix */
.ike-matrix {
    background-color: white;
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: var(--shadow);
}

body.dark-mode .ike-matrix {
    background-color: rgba(255, 255, 255, 0.05);
}

.matrix-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
    padding-right: 1rem;
}

.time-label {
    font-weight: 600;
    text-align: center;
}

.matrix-body {
    display: flex;
    gap: 1rem;
}

.energy-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 80px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: right;
    padding-right: 1rem;
    border-right: 2px solid var(--border-light);
}

body.dark-mode .energy-axis {
    border-right-color: var(--border-dark);
}

.axis-label {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matrix-quadrants {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    flex: 1;
}

.quadrant {
    min-height: 250px;
    border: 2px dashed var(--border-light);
    border-radius: 0.75rem;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
}

body.dark-mode .quadrant {
    background-color: rgba(255, 255, 255, 0.02);
    border-color: var(--border-dark);
}

.quadrant:hover {
    border-color: var(--primary);
    background-color: rgba(59, 130, 246, 0.05);
}

.quadrant.do-first { border-color: #ef4444; }
.quadrant.schedule { border-color: #f59e0b; }
.quadrant.delegate { border-color: #3b82f6; }
.quadrant.eliminate { border-color: #6b7280; }

.quadrant-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.do-first .quadrant-label { color: #ef4444; }
.schedule .quadrant-label { color: #f59e0b; }
.delegate .quadrant-label { color: #3b82f6; }
.eliminate .quadrant-label { color: #6b7280; }

.task-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.matrix-task {
    background-color: white;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    border-left: 3px solid var(--primary);
    cursor: grab;
    transition: all 0.2s;
}

body.dark-mode .matrix-task {
    background-color: rgba(255, 255, 255, 0.1);
}

.matrix-task:active {
    cursor: grabbing;
    opacity: 0.7;
}

/* Habits */
.habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.habit-card {
    background-color: white;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

body.dark-mode .habit-card {
    background-color: rgba(255, 255, 255, 0.05);
}

.habit-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.habit-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.habit-icon {
    width: 50px;
    height: 50px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.habit-name {
    font-weight: 600;
    font-size: 1.05rem;
}

.habit-target {
    font-size: 0.85rem;
    color: #6b7280;
}

body.dark-mode .habit-target {
    color: #9ca3af;
}

.habit-counter {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 1rem 0;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 0.5rem;
}

body.dark-mode .habit-counter {
    background-color: rgba(255, 255, 255, 0.05);
}

.counter-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.2s;
}

.counter-btn:hover {
    transform: scale(1.2);
}

.counter-display {
    text-align: center;
}

.counter-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.counter-target {
    font-size: 0.8rem;
    color: #6b7280;
}

body.dark-mode .counter-target {
    color: #9ca3af;
}

.habit-progress {
    width: 100%;
    height: 6px;
    background-color: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    margin: 1rem 0;
}

body.dark-mode .habit-progress {
    background-color: var(--border-dark);
}

.progress-fill {
    height: 100%;
    background-color: var(--primary);
    transition: width 0.3s;
}

/* Calendar */
.calendar-container {
    background-color: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

body.dark-mode .calendar-container {
    background-color: rgba(255, 255, 255, 0.05);
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.calendar-nav button {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
}

.calendar-nav h3 {
    font-size: 1.25rem;
    min-width: 200px;
    text-align: center;
}

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

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    padding: 0.5rem;
    font-size: 0.9rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: 0.5rem;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

body.dark-mode .calendar-day {
    border-color: var(--border-dark);
}

.calendar-day:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.calendar-day.other-month {
    opacity: 0.5;
}

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

.calendar-day.completed {
    background-color: var(--success);
    color: white;
}

/* Analytics */
.analytics-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.analytics-section {
    background-color: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

body.dark-mode .analytics-section {
    background-color: rgba(255, 255, 255, 0.05);
}

.analytics-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
}

.analytics-table th,
.analytics-table td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

body.dark-mode .analytics-table th,
body.dark-mode .analytics-table td {
    border-bottom-color: var(--border-dark);
}

.analytics-table th {
    font-weight: 600;
    background-color: rgba(0, 0, 0, 0.02);
}

body.dark-mode .analytics-table th {
    background-color: rgba(255, 255, 255, 0.05);
}

.chart-container {
    width: 100%;
    height: 300px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 1rem;
}

.chart-bar {
    flex: 1;
    background-color: var(--primary);
    border-radius: 0.25rem 0.25rem 0 0;
    position: relative;
    min-height: 20px;
    transition: all 0.2s;
}

.chart-bar:hover {
    opacity: 0.8;
}

.chart-label {
    position: absolute;
    bottom: -2rem;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.8rem;
}

/* Settings */
.settings-container {
    display: grid;
    gap: 2rem;
}

.settings-section {
    background-color: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

body.dark-mode .settings-section {
    background-color: rgba(255, 255, 255, 0.05);
}

.settings-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

body.dark-mode .setting-item {
    border-bottom-color: var(--border-dark);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    font-weight: 500;
}

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

.settings-section .btn {
    margin-top: 1rem;
    width: 100%;
    justify-content: center;
}

.settings-section .btn + .btn {
    margin-top: 0.5rem;
}

.settings-section p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {
    .tab-navigation {
        justify-content: space-between;
    }

    .tab-button {
        flex: 0 1 auto;
        min-width: 80px;
    }

    .ike-matrix {
        padding: 0.5rem;
    }

    .matrix-body {
        flex-direction: column;
    }

    .energy-axis {
        flex-direction: row;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 2px solid var(--border-light);
        margin-bottom: 1rem;
        padding-right: 0;
        padding-bottom: 1rem;
    }

    .axis-label {
        height: auto;
        width: auto;
        flex: 1;
    }

    .matrix-quadrants {
        grid-template-columns: 1fr;
    }

    .quadrant {
        min-height: 150px;
    }

    .habits-grid {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .header-stats {
        flex-direction: column;
        gap: 1rem;
        align-self: flex-start;
    }

    .color-picker {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .tab-button span {
        display: none;
    }

    .view-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .view-header .btn {
        align-self: flex-start;
    }
}

/* Tutorial Styles */

.tutorial-content {
    max-width: 700px;
}

.tutorial-steps {
    min-height: 400px;
    position: relative;
}

.tutorial-step {
    display: none;
    animation: fadeIn 0.5s ease-in;
    text-align: center;
    padding: 2rem;
}

.tutorial-step.active {
    display: block;
}

.tutorial-illustration {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.tutorial-step h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.tutorial-step p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.8;
    color: #6b7280;
}

body.dark-mode .tutorial-step p {
    color: #9ca3af;
}

.tutorial-list {
    list-style: none;
    text-align: left;
    margin: 1.5rem auto;
    max-width: 500px;
}

.tutorial-list li {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 0.5rem;
    border-left: 3px solid var(--primary);
}

body.dark-mode .tutorial-list li {
    background-color: rgba(255, 255, 255, 0.05);
}

.tutorial-tip {
    background-color: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
    font-weight: 500;
    color: #92400e;
}

body.dark-mode .tutorial-tip {
    background-color: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
}

.tutorial-progress {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 2rem;
    font-weight: 500;
}

.tutorial-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-light);
}

body.dark-mode .tutorial-footer {
    border-top-color: var(--border-dark);
}

.tutorial-footer .btn {
    margin: 0;
}

/* Tutorial Floating Action Button */
.tutorial-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s;
    z-index: 100;
}

.tutorial-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 25px rgba(59, 130, 246, 0.3);
}

.tutorial-fab:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .tutorial-fab {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .tutorial-content {
        max-width: 90%;
    }

    .tutorial-step {
        padding: 1.5rem;
    }

    .tutorial-illustration {
        font-size: 3rem;
    }

    .tutorial-step h3 {
        font-size: 1.25rem;
    }

    .tutorial-footer {
        flex-direction: column;
        gap: 0.75rem;
    }

    .tutorial-footer .btn {
        width: 100%;
    }
}
