/**
 * Momentum52 - Common Components
 * 
 * Purpose: Shared components used across multiple pages
 * Dependencies: css-variables.css (must be loaded first)
 * 
 * Contents:
 * - Header & Logo
 * - Navigation (Desktop & Mobile)
 * - Buttons (All variants)
 * - Cards
 * - Forms
 * - User Session Components
 * - Modals
 */


/* ==================================================
   HEADER, LOGO, NAVIGATION & MOBILE MENU
   Now centralized in css/components/header.css
   DO NOT ADD HEADER STYLES HERE - use header.css
   ================================================== */


/* ==================================================
   BUTTONS - All Variants
   Found on: Most pages
   Duplication: ~200 lines across pages
   ================================================== */

/* Base Button */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: var(--weight-semibold);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--transition-base), 
                box-shadow var(--transition-base);
    border: none;
    line-height: 1.5;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

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

/* Primary Button (Blue) */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Success Button (Green) */
.btn-success {
    background: var(--gradient-success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* Warning Button (Yellow) */
.btn-warning {
    background: var(--gradient-warning);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

/* Danger Button (Red) */
.btn-danger {
    background: var(--gradient-danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Secondary Button (Outline) */
.btn-secondary {
    background: transparent;
    border: 2px solid var(--border-primary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Text Button (No Background) */
.btn-text {
    background: none;
    padding: 0.5rem 1rem;
    color: var(--accent-primary);
}

.btn-text:hover:not(:disabled) {
    color: var(--accent-hover);
    background-color: var(--accent-bg);
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-full {
    width: 100%;
}


/* ==================================================
   CARDS
   Found on: index, discover, journey-detail, week-detail
   Duplication: ~150 lines across pages
   ================================================== */

/* Base Card */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: transform var(--transition-base), 
                box-shadow var(--transition-base);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* Card Header */
.card-header {
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: var(--space-md);
}

.card-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

/* Card Body */
.card-body {
    line-height: 1.6;
}

/* Card Footer */
.card-footer {
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-primary);
    margin-top: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Card Variants */
.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    border-color: var(--accent-primary);
}

.card-bordered {
    border-width: 2px;
}


/* ==================================================
   FORMS
   Found on: create-journey, profile, dare-to-dream
   Duplication: ~200 lines across pages
   ================================================== */

/* Form Group */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    font-weight: var(--weight-medium);
    font-size: 0.95rem;
}

/* Text Inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-primary);
    transition: border-color var(--transition-base),
                box-shadow var(--transition-base);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
}

/* Textarea Specific */
textarea {
    resize: vertical;
    min-height: 100px;
}

/* Select Specific */
select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23cbd5e1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* Checkbox & Radio */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin-right: var(--space-sm);
    cursor: pointer;
}

/* Form Helper Text */
.form-help {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
}

/* Form Validation States */
.form-group.error input,
.form-group.error textarea,
.form-group.error select {
    border-color: var(--danger);
}

.form-group.success input,
.form-group.success textarea,
.form-group.success select {
    border-color: var(--success);
}

.form-error {
    color: var(--danger);
    font-size: var(--text-sm);
    margin-top: var(--space-xs);
}

.form-success {
    color: var(--success);
    font-size: var(--text-sm);
    margin-top: var(--space-xs);
}


/* ==================================================
   USER SESSION COMPONENTS
   Found on: ALL pages
   Duplication: ~50 lines per page
   ================================================== */

.user-session-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* User Switcher */
#userSwitcher {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color var(--transition-base),
                border-color var(--transition-base);
}

#userSwitcher:hover {
    background-color: var(--bg-quaternary);
    border-color: var(--accent-primary);
}

#userSwitcher:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

/* Dev Mode Toggle */
#devModeToggle {
    background-color: var(--warning);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: background-color var(--transition-base);
}

#devModeToggle:hover {
    background-color: var(--warning-hover);
}

/* Dev Panel */
#devPanel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border-top: 2px solid var(--warning);
    padding: var(--space-md);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-fixed);
}


/* ==================================================
   MODALS
   Found on: manage-journey, profile
   Duplication: ~100 lines across pages
   ================================================== */

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--overlay);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

/* Modal Container */
.modal {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

/* Modal Header */
.modal-header {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: var(--text-2xl);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-base),
                color var(--transition-base);
}

.modal-close:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Modal Body */
.modal-body {
    padding: var(--space-xl);
}

/* Modal Footer */
.modal-footer {
    padding: var(--space-xl);
    border-top: 1px solid var(--border-primary);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
}


/* ==================================================
   RESPONSIVE UTILITIES
   ================================================== */

@media (max-width: 768px) {
    /* Header/Nav mobile responsive styles centralized in header.css */
    /* DO NOT ADD: nav, .menu-btn, .logo, header, .user-session-area styles here */

    /* Full-width buttons on mobile */
    .btn {
        width: 100%;
    }

    /* Stack card footer on mobile */
    .card-footer {
        flex-direction: column;
        gap: var(--space-md);
    }
}

@media (max-width: 375px) {
    /* Extra small screens */
    .logo {
        font-size: 1.25rem;
    }

    .modal {
        width: 95%;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--space-md);
    }
}


/* ==================================================
   UTILITY CLASSES
   ================================================== */

/* Spacing Utilities */
.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-bold { font-weight: var(--weight-bold); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-normal { font-weight: var(--weight-normal); }

/* Display Utilities */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.grid { display: grid; }


/* ==================================================
   SITE FOOTER
   Found on: ALL main pages
   ================================================== */

.site-footer {
    border-top: 1px solid var(--border-primary);
    padding: 2rem;
    text-align: center;
    margin-top: auto;
}

.site-footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.site-footer-links a {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color var(--transition-base);
}

.site-footer-links a:hover {
    color: var(--text-secondary);
}

.site-footer-copy {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}


/* ==================================================
   END OF COMMON COMPONENTS
   ================================================== */
