/* ==========================================
   Custom Goals Styles
   TheYearBar.com
   ========================================== */

/* ==========================================
   1. NAVBAR MODIFICATIONS
   ========================================== */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    font-family: 'Poppings', sans-serif;
    cursor: pointer;
}

.add-goal-btn {
    background: none;
    border: 2px solid var(--accent);
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 300;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    line-height: 1;
}

.add-goal-btn:hover {
    background-color: var(--accent);
    color: #FFFFFF;
    transform: scale(1.1);
}

.add-goal-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

/* ==========================================
   2. GOAL INPUT MODAL
   ========================================== */

.goal-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.goal-modal-overlay.show {
    display: flex;
    opacity: 1;
}

.goal-modal-overlay.closing {
    opacity: 0;
}

.goal-modal-content {
    background-color: var(--bg-primary);
    border: 2px solid var(--accent);
    border-radius: 16px;
    padding: 32px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    animation: goalModalSlideIn 0.4s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes goalModalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.goal-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease, transform 0.3s ease;
}

.goal-modal-close:hover {
    color: var(--accent);
    transform: rotate(90deg);
}

.goal-modal-close:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.goal-modal-content h2 {
    font-family: 'Poppins', sans-serif;
    color: var(--accent);
    font-size: 1.75rem;
    margin-bottom: 24px;
    text-align: center;
}

/* Form Styles */
.goal-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-counter {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.form-group input[type="text"],
.form-group input[type="date"] {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    padding: 12px 16px;
    border: 2px solid var(--footer-bg);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group input[type="color"] {
    width: 100%;
    height: 50px;
    border: 2px solid var(--footer-bg);
    border-radius: 8px;
    cursor: pointer;
    padding: 4px;
    background-color: var(--bg-primary);
}

.form-group input[type="color"]:focus {
    outline: none;
    border-color: var(--accent);
}

.save-goal-btn {
    width: 100%;
    background-color: var(--accent);
    color: #FFFFFF;
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(244, 162, 97, 0.4);
    margin-top: 8px;
}

.save-goal-btn:hover {
    background-color: #E8935A;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(244, 162, 97, 0.5);
}

.save-goal-btn:active {
    transform: translateY(0);
}

/* ==========================================
   3. CUSTOM GOALS CONTAINER
   ========================================== */

#custom-goals-container {
    margin-top: 3rem;
    display: none; /* Hidden by default - shown with sub-bars */
    flex-direction: column;
    gap: 1.5rem;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.4s ease;
}

#custom-goals-container.visible {
    display: flex;
    opacity: 1;
    max-height: 2000px;
}

.goals-section-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
    font-size: 1rem;
    font-style: italic;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ==========================================
   4. CUSTOM GOAL BAR
   ========================================== */

.custom-goal-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 16px;
    background-color: var(--footer-bg);
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 1rem; /* Fixed: Add spacing between goal cards */
}

.custom-goal-item:last-child {
    margin-bottom: 0; /* Remove margin from last item */
}

.custom-goal-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.custom-goal-item.completed {
    border: 2px solid #10B981;
}

.custom-goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.goal-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.goal-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.goal-completed-icon {
    font-size: 1.2rem;
}

.delete-goal-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.3s ease;
    opacity: 0.6;
    line-height: 1;
    font-weight: 300;
}

.delete-goal-btn:hover {
    opacity: 1;
    color: #EF4444;
    transform: scale(1.15);
}

.delete-goal-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.goal-progress-value {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

.custom-goal-bar-container {
    width: 100%;
    height: 12px;
    background-color: var(--bg-primary);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.custom-goal-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.goal-dates {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ==========================================
   5. IMPORT LINK (in Modal)
   ========================================== */

.modal-import-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--footer-bg);
    text-align: center;
}

.modal-import-link {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.modal-import-link:hover {
    color: var(--accent);
}

.import-icon {
    font-size: 1rem;
}

#import-file {
    display: none;
}

/* ==========================================
   6. TOAST NOTIFICATION
   ========================================== */

.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--accent);
    color: #FFFFFF;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================
   6. RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    header {
        padding: 1rem 1.5rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    .add-goal-btn {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }

    .goal-modal-content {
        padding: 24px 20px;
        max-width: 95%;
    }

    .goal-modal-content h2 {
        font-size: 1.5rem;
    }

    .custom-goal-item {
        padding: 12px;
    }

    .toast-notification {
        font-size: 0.9rem;
        padding: 10px 20px;
    }
}

@media (max-width: 480px) {
    .modal-backup-links {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
}

/* ==========================================
   7. DARK MODE ADJUSTMENTS
   ========================================== */

@media (prefers-color-scheme: dark) {
    .custom-goal-item {
        background-color: #1F2937;
    }

    .custom-goal-bar-container {
        background-color: #111827;
    }
}

/* ==========================================
   8. ACCESSIBILITY
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    .goal-modal-overlay,
    .goal-modal-content,
    .custom-goal-item,
    .custom-goal-bar,
    .backup-btn,
    .add-goal-btn {
        animation: none !important;
        transition: none !important;
    }
}