@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&family=Playfair+Display:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #6c5ce7;
    --primary-dark: #5649c0;
    --secondary-color: #00cec9;
    --accent-color: #fd79a8;
    --dark-color: #2d3436;
    --light-color: #f5f6fa;
    --success-color: #00b894;
    --danger-color: #d63031;
    --warning-color: #fdcb6e;
    --info-color: #0984e3;
    --gold-gradient: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    --purple-gradient: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    --teal-gradient: linear-gradient(135deg, #00cec9 0%, #81ecec 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* =============== LOGIC UNTUK PERGANTIAN TAMPILAN =============== */
.view {
    display: none; /* Semua view disembunyikan secara default */
    width: 100%;
    min-height: 100vh;
}
.view.active {
    display: block; /* Hanya view dengan kelas .active yang tampil */
}

/* =============== AUTH VIEW (UNTUK LOGIN & SIGNUP) =============== */
#login-view, #signup-view {
    display: none; /* Disembunyikan, akan diaktifkan oleh JS */
    justify-content: center;
    align-items: center;
    background: var(--purple-gradient);
    padding: 2rem;
}

#login-view.active, #signup-view.active {
    display: flex; /* Tampilkan sebagai flex saat aktif */
}

.auth-container {
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.auth-header {
    background: transparent;
    padding: 2rem 2rem 1rem 2rem;
    text-align: center;
    color: var(--dark-color);
}

.auth-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
}

.auth-header p {
    font-size: 0.9rem;
    color: #666;
}

.auth-form {
    padding: 1.5rem 2.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius-sm);
    background-color: #fff;
    transition: var(--transition);
    font-family: 'Montserrat', sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
}

.auth-footer {
    text-align: center;
    padding: 0 2.5rem 2.5rem;
    font-size: 0.9rem;
    color: #666;
}

.auth-footer a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }


/* =============== DASHBOARD VIEW =============== */
#dashboard-view.active {
    display: flex; /* KHUSUS untuk dashboard, paksa display: flex saat aktif */
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: white;
    box-shadow: var(--shadow-md);
    z-index: 10;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
}

.sidebar-header h1 svg {
    margin-right: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    color: #666;
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

.nav-item:hover {
    color: var(--primary-color);
    background: rgba(108, 92, 231, 0.05);
}

.nav-item.active {
    color: var(--primary-color);
    background: rgba(108, 92, 231, 0.1);
    border-right: 3px solid var(--primary-color);
}

.nav-item svg {
    margin-right: 0.8rem;
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.user-profile {
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--purple-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    margin-right: 0.8rem;
}

.user-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.user-info p {
    font-size: 0.8rem;
    color: #888;
}

/* Main Content */
.main-content {
    flex: 1;
    background: #f9f9f9;
    padding: 2rem;
    overflow-y: auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-title h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark-color);
}

.dashboard-title p {
    color: #666;
    font-size: 0.9rem;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem;
    border-radius: 50%;
    background: white;
    color: var(--dark-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Stats Cards */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
}

.stat-card.success::before {
    background: var(--success-color);
}

.stat-card.danger::before {
    background: var(--danger-color);
}

.stat-card.warning::before {
    background: var(--warning-color);
}

.stat-card .stat-title {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-card .stat-change {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
}

.stat-card .stat-change.positive {
    color: var(--success-color);
}

.stat-card .stat-change.negative {
    color: var(--danger-color);
}

/* Commitment Form */
.commitment-form-container {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.commitment-form-container h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

#commitment-form {
    display: flex;
    gap: 1rem;
}

#commitment-form input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: var(--transition);
}

#commitment-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

#commitment-form button {
    padding: 0.8rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

#commitment-form button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Commitments List */
.commitments-section {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.commitments-section h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
    display: flex;
    align-items: center;
}

.commitments-section h3 svg {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

#commitments-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.commitment-card {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

.commitment-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: rgba(108, 92, 231, 0.2);
}

.commitment-card .commitment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.commitment-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-color);
    flex: 1;
}

.commitment-card .commitment-date {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.commitment-card .card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.check-in-btn {
    flex: 1;
    padding: 0.6rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.check-in-btn.success {
    background: var(--success-color);
    color: white;
}

.check-in-btn.success:hover {
    background: #00a884;
    transform: translateY(-2px);
}

.check-in-btn.fail {
    background: var(--danger-color);
    color: white;
}

.check-in-btn.fail:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.check-in-btn:disabled {
    background: #ddd;
    color: #888;
    cursor: not-allowed;
    transform: none;
}

.progress-calendar {
    display: grid;
    grid-template-columns: repeat(14, 1fr); /* Tampilkan 14 hari */
    gap: 4px;
    margin-top: 1rem;
}

.calendar-day {
    aspect-ratio: 1 / 1; /* Membuat kotak */
    border-radius: 4px;
    background: #f0f0f0;
    transition: var(--transition);
}

.calendar-day.success {
    background: var(--success-color);
}

.calendar-day.fail {
    background: var(--danger-color);
}

.delete-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    transition: var(--transition);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.delete-btn:hover {
    color: var(--danger-color);
    background: rgba(214, 48, 49, 0.1);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    grid-column: 1 / -1; /* Agar memenuhi seluruh grid */
}

.empty-state i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 1.5rem;
}

.empty-state h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #888;
    max-width: 400px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #dashboard-view.active {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 0 1rem;
        box-shadow: var(--shadow-sm);
    }
    .sidebar-header, .sidebar-footer {
        display: none;
    }
    .sidebar-nav {
        flex: 1;
        display: flex;
        justify-content: space-around;
        padding: 0;
    }
    .nav-item {
        padding: 1rem 0.5rem;
    }
    .main-content {
        padding: 1.5rem;
    }
}