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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #2d3748 0%, #4a5568 100%);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.logo {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    color: #4CAF50;
    font-size: 1.5rem;
}

.logo h2 {
    color: white;
    font-weight: 600;
    font-size: 1.25rem;
}

.nav-menu {
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: #e2e8f0;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border-left-color: #4CAF50;
}

.nav-item i {
    width: 20px;
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    background: #f8fafc;
    min-height: 100vh;
}

/* Section Header */
.section-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    background: linear-gradient(135deg, #4CAF50, #2196F3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.date-display {
    color: #64748b;
    font-weight: 500;
}

/* View Sections */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card h3 {
    margin-bottom: 1rem;
    color: #2d3748;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h3 i {
    color: #4CAF50;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* Streak Card */
.streak-card {
    grid-column: span 2;
}

.streak-container {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.overall-streak {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-radius: 12px;
    color: white;
    min-width: 120px;
}

.streak-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
}

.streak-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.principle-streaks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.principle-streak {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.principle-streak.active {
    background: #dcfce7;
    border-color: #4CAF50;
    color: #16a34a;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #4CAF50;
}

.stat-label {
    font-size: 0.875rem;
    color: #64748b;
}

/* Activity Feed */
.activity-feed {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #4CAF50;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    color: #2d3748;
}

.activity-time {
    font-size: 0.75rem;
    color: #64748b;
}

/* Principles Overview */
.principles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.principle-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.principle-card:hover {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.principle-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: #4CAF50;
    margin-bottom: 0.5rem;
}

.principle-card:hover .principle-number {
    color: white;
}

.principle-name {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.principle-score {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Daily Tracking */
.tracking-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.principles-checklist {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.principle-item {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.principle-item.completed {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border: 1px solid #4CAF50;
}

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

.principle-title {
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.principle-toggle {
    width: 50px;
    height: 26px;
    background: #e2e8f0;
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.principle-toggle.active {
    background: #4CAF50;
}

.principle-toggle::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.principle-toggle.active::after {
    transform: translateX(24px);
}

.principle-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.metric-item {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
}

.metric-label {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.metric-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
}

.metric-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
}

.metric-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
}

.metric-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
}

/* Daily Notes */
.daily-notes {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.daily-notes h3 {
    margin-bottom: 1rem;
    color: #2d3748;
    font-weight: 600;
}

.daily-notes textarea {
    width: 100%;
    height: 200px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Date Selector */
.date-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-date {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-date:hover {
    background: #f8fafc;
    border-color: #4CAF50;
}

.date-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: inherit;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-secondary {
    background: white;
    color: #4CAF50;
    border: 1px solid #4CAF50;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #4CAF50;
    color: white;
}

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

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #000;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.875rem;
}

.form-group textarea {
    resize: vertical;
    height: 80px;
}

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

.goal-item {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #4CAF50;
    margin-bottom: 1rem;
}

.goal-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.goal-title {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.25rem;
}

.goal-principle {
    font-size: 0.875rem;
    color: #4CAF50;
    font-weight: 500;
}

.goal-progress {
    margin: 1rem 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    transition: width 0.3s ease;
}

.goal-deadline {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.5rem;
}

/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.time-filter {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn.active,
.filter-btn:hover {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* Calendar */
.calendar-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calendar-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.calendar-controls button {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #4CAF50;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.calendar-controls button:hover {
    background: #f0f9ff;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    margin: 1rem 0;
}

.calendar-header {
    background: #f8fafc;
    padding: 1rem 0.5rem;
    text-align: center;
    font-weight: 600;
    color: #2d3748;
    font-size: 0.875rem;
}

.calendar-day {
    background: white;
    padding: 1rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.calendar-day:hover {
    background: #f8fafc;
}

.calendar-day.other-month {
    color: #cbd5e0;
    background: #f8fafc;
}

.calendar-day.today {
    background: #4CAF50;
    color: white;
}

.calendar-day.has-data::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4CAF50;
}

.calendar-day.today.has-data::after {
    background: white;
}

.calendar-legend {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

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

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

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

.export-format {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.export-format label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.export-format label:hover {
    background: #f8fafc;
}

.export-range {
    margin-bottom: 1rem;
}

.export-range h4 {
    margin-bottom: 0.5rem;
    color: #2d3748;
}

.export-range input {
    margin: 0 0.5rem;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #4CAF50;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 3000;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background: #f44336;
}

.toast.warning {
    background: #ff9800;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

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

    .streak-card {
        grid-column: span 1;
    }

    .tracking-container {
        grid-template-columns: 1fr;
    }

    .goals-container {
        grid-template-columns: 1fr;
    }

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

    .export-container {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .principles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .principle-metrics {
        grid-template-columns: 1fr;
    }

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

    .calendar-day {
        min-height: 40px;
        font-size: 0.875rem;
    }
}

/* Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #64748b;
}

.loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}