* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #2c3e50;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* Auth Pages (Login/Register) */
.auth-container {
    background: #ffffff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-container h2 {
    margin-bottom: 30px;
    font-weight: 600;
    color: #1a252f;
}

input, textarea {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 20px;
    border: 1.5px solid #e1e8ed;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
}

input:focus, textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

button {
    width: 100%;
    padding: 14px;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

button:hover {
    background-color: #1a252f;
}

a.text-link {
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    margin-top: 15px;
    transition: color 0.3s;
}

a.text-link:hover {
    color: #2980b9;
}

.error-msg {
    color: #e74c3c;
    background: #fadbd8;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Main Dashboard (habit.php) */
body.dashboard-body {
    display: block;
    background-color: #f5f7fa;
}

.dashboard-wrapper {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 20px 30px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    margin-bottom: 40px;
}

.navbar h1 {
    font-size: 24px;
    font-weight: 600;
}

.btn-logout {
    background-color: #e74c3c;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-logout:hover {
    background-color: #c0392b;
}

/* Dashboard Layout */
.dashboard-grid {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

/* Analytics Placeholder */
.analytics-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    border: 2px dashed #dcdde1;
    color: #7f8fa6;
    font-weight: 500;
    margin-bottom: 20px;
}

/* Task Management Area */
.card {
    background: #ffffff;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f2f6;
    padding-bottom: 15px;
}

/* Task List */
.task-list {
    list-style: none;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.task-item:hover {
    background: #f1f2f6;
}

.task-actions form {
    display: inline-block;
    margin-left: 5px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    width: auto;
}

.btn-edit { background: #f39c12; }
.btn-edit:hover { background: #e67e22; }
.btn-delete { background: #e74c3c; }
.btn-delete:hover { background: #c0392b; }

/* Add Task Form */
.add-task-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.add-task-form input {
    margin-bottom: 0;
}

/* Bottom Actions */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn-primary { background: #2ecc71; font-size: 18px;}
.btn-primary:hover { background: #27ae60; }
.btn-secondary { background: #34495e; font-size: 18px;}
.btn-secondary:hover { background: #2c3e50; }

/* =========================================
   Daily Tracking Styles - FIXED
   ========================================= */
.daily-header {
    text-align: center;
    margin-bottom: 20px;
    color: #34495e;
}

.status-form {
    display: flex;
    flex-direction: row !important; /* Forces horizontal layout */
    gap: 8px;
}

button.btn-status {
    width: auto !important; /* Overrides the global 100% width */
    padding: 8px 16px;
    border-radius: 20px; /* Nice pill shape */
    font-size: 13px;
    font-weight: 600;
    border: 1.5px solid #dcdde1;
    background-color: #ffffff !important;
    color: #7f8fa6 !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Active States for Buttons */
button.btn-status:hover { background: #f1f2f6 !important; }
button.btn-status.active-done { background: #2ecc71 !important; color: white !important; border-color: #2ecc71 !important; }
button.btn-status.active-missed { background: #e74c3c !important; color: white !important; border-color: #e74c3c !important; }
button.btn-status.active-pending { background: #f39c12 !important; color: white !important; border-color: #f39c12 !important; }

/* Achievements Textbox */
.achievements-box {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    margin-top: 10px;
    margin-bottom: 15px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
}

.achievements-box:focus {
    border-color: #3498db;
    outline: none;
}

/* =========================================
   Mobile Responsiveness (Phones & Tablets)
   ========================================= */
@media (max-width: 768px) {
    /* Auth Pages */
    .auth-container {
        padding: 30px 20px;
        width: 90%;
    }

    /* Dashboard Layout */
    .dashboard-wrapper {
        margin: 20px auto;
    }

    /* Fix for Mobile Navbar overlap */
    .navbar {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 15px;
        text-align: center;
        padding: 15px 20px;
    }
    
    .navbar .btn-secondary {
        width: 100%;
        text-align: center;
    }

    .btn-logout {
        width: 100%;
    }

    /* Add Task Form */
    .add-task-form {
        flex-direction: column;
    }
    
    .add-task-form button {
        width: 100% !important;
    }

    /* Fix for Mobile Daily Tasks */
    .task-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
        gap: 15px;
    }

    .task-name {
        margin-bottom: 5px;
        font-size: 16px;
        font-weight: 600;
    }

    .task-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }

    .status-form {
        width: 100%;
        justify-content: space-between; /* Spreads the 3 buttons evenly */
    }

    button.btn-status {
        flex: 1; /* Makes the buttons share the space perfectly */
        max-width: 32%;
        padding: 10px 5px;
        text-align: center;
    }

    /* Bottom Actions */
    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
    }
}