/* Main Stylesheet - Life Trails */

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary: #ec4899;
    --secondary-hover: #db2777;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* Gradient Theme (Default) - Modern with gradients */
    --bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-solid: #f8fafc;
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --bg-tertiary: rgba(255, 255, 255, 0.8);
    --panel: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    --panel-solid: #f1f5f9;
    --card: rgba(255, 255, 255, 0.95);
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: rgba(99, 102, 241, 0.2);
    --border-light: rgba(99, 102, 241, 0.1);
    --shadow: rgba(99, 102, 241, 0.15);
    --shadow-lg: rgba(99, 102, 241, 0.25);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

[data-theme="dark"] {
    --bg: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --bg-solid: #0f172a;
    --bg-secondary: rgba(30, 27, 75, 0.95);
    --bg-tertiary: rgba(30, 27, 75, 0.8);
    --panel: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --panel-solid: #1e293b;
    --card: rgba(30, 27, 75, 0.95);
    --text: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: rgba(139, 92, 246, 0.3);
    --border-light: rgba(139, 92, 246, 0.15);
    --shadow: rgba(139, 92, 246, 0.25);
    --shadow-lg: rgba(139, 92, 246, 0.4);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-solid);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: -1;
    opacity: 0.05;
}

/* Header */
header {
    background: var(--panel);
    border-bottom: 2px solid var(--border);
    padding: 16px 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px var(--shadow);
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

[data-theme="light"] header {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-bottom: 2px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 2px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.logo-img {
    height: 70px;
    width: auto;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.3));
}

.logo span {
    display: inline;
    margin-left: 0;
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    background: var(--gradient-secondary);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-icon {
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
}

/* Neumorphic Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.theme-toggle-track {
    position: relative;
    display: flex;
    align-items: center;
    padding: 6px;
    border-radius: 20px;
    transition: all 0.3s ease;
    min-width: 90px;
    height: 40px;
}

.theme-toggle-light .theme-toggle-track {
    background: #e0e0e0;
    box-shadow: 
        inset 4px 4px 8px rgba(0, 0, 0, 0.1),
        inset -4px -4px 8px rgba(255, 255, 255, 0.7);
}

.theme-toggle-dark .theme-toggle-track {
    background: #363a42;
    box-shadow: 
        inset 4px 4px 8px rgba(0, 0, 0, 0.3),
        inset -4px -4px 8px rgba(255, 255, 255, 0.05);
}

.theme-toggle-knob {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.theme-toggle-light .theme-toggle-knob {
    left: 4px;
    background: #e0e0e0;
    box-shadow: 
        3px 3px 6px rgba(0, 0, 0, 0.2),
        -3px -3px 6px rgba(255, 255, 255, 0.8);
    color: #888888;
}

.theme-toggle-dark .theme-toggle-knob {
    left: calc(100% - 36px);
    background: #6c757d;
    box-shadow: 
        3px 3px 6px rgba(0, 0, 0, 0.4),
        -3px -3px 6px rgba(255, 255, 255, 0.1);
    color: #cccccc;
}

.theme-toggle-icon {
    width: 40px;
    height: 40px;
    stroke: currentColor;
}

.theme-toggle-text {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    z-index: 1;
    pointer-events: none;
    line-height: 1.2;
    text-align: center;
}

.theme-toggle-light .theme-toggle-text {
    margin-left: 40px;
    color: #888888;
}

.theme-toggle-dark .theme-toggle-text {
    margin-right: 40px;
    margin-left: auto;
    color: #cccccc;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
}

.container-sm {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px;
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px var(--shadow);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px var(--shadow-lg);
    border-color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
    font-size: 14px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* Sidebar */
aside {
    width: 240px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 24px 20px;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
}

aside h3 {
    margin: 0 0 16px 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.year-link {
    display: block;
    padding: 8px 12px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.year-link:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

/* Timeline */
.timeline-container {
    padding: 32px;
}

.section {
    margin-bottom: 48px;
}

.year {
    font-size: 32px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 32px;
    letter-spacing: -1px;
}

.month-group {
    margin-bottom: 32px;
}

.month {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 16px;
    text-transform: capitalize;
}

.event {
    position: relative;
    padding-left: 32px;
    margin-bottom: 24px;
}

.event::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 8px;
    width: 2px;
    height: calc(100% - 8px);
    background: var(--border);
}

.event::after {
    content: "";
    position: absolute;
    left: -6px;
    top: 6px;
    width: 12px;
    height: 12px;
    background: var(--gradient-primary);
    border-radius: 50%;
    border: 2px solid var(--bg-solid);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.meta-line {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.meta-line span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.event-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.event-description {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.images.single {
    grid-template-columns: 1fr;
}

.images img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.images img:hover {
    transform: scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    max-width: 1000px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
}

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

/* Family Tree */
.generation {
    margin-bottom: 40px;
}

.generation-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    text-align: center;
}

.generation-members {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.family-member {
    text-align: center;
    min-width: 100px;
}

.family-member img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.family-member:hover img {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.family-member-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.family-member-relation {
    font-size: 13px;
    color: var(--text-muted);
}

.family-member-self {
    position: relative;
}

.family-member-self-img {
    border: 4px solid var(--primary) !important;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5) !important;
    transform: scale(1.1);
}

.family-member-self-name {
    font-weight: 700 !important;
    color: var(--primary) !important;
    font-size: 16px !important;
}

.generation-separator {
    width: 80%;
    height: 2px;
    background: var(--border);
    margin: 30px auto;
    border-radius: 2px;
}

.generation-separator-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 100%;
    color: var(--primary);
    font-size: 24px;
    font-weight: 300;
    opacity: 0.6;
    margin: 0 10px;
}

.generation-connector {
    text-align: center;
    color: var(--primary);
    font-size: 20px;
    margin: 20px 0;
    opacity: 0.5;
}

/* Profile */
.profile {
    margin-bottom: 32px;
}

.profile h1 {
    margin: 0 0 8px 0;
    font-size: 36px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.profile .meta {
    color: var(--text-muted);
    font-size: 15px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.profile .meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Search */
.search {
    margin-top: 20px;
}

.search input {
    width: 100%;
    max-width: 500px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    transition: all 0.2s ease;
}

.search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.search input::placeholder {
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text);
}

/* Image Modal */
.image-modal-wrapper {
    position: relative;
    width: 90vw;
    max-width: 1200px;
    height: 90vh;
    max-height: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    padding: 20px;
}

.image-modal-wrapper img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px var(--shadow-lg);
    display: block;
}

.image-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 300;
    transition: all 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.image-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
        gap: 12px;
    }

    .header-nav {
        flex-wrap: nowrap;
        gap: 12px;
        align-items: center;
        min-width: 0;
    }

    .header-nav .btn {
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 13px;
        flex-shrink: 0;
    }

    .theme-toggle {
        flex-shrink: 0;
    }

    .logo-img {
        height: 55px;
    }

    .logo span {
        font-size: 22px;
    }

    aside {
        display: none;
    }

    .container,
    .container-sm {
        padding: 20px;
    }

    .timeline-container {
        padding: 20px;
    }

    .year {
        font-size: 26px;
    }

    .event {
        padding-left: 24px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .generation-members {
        gap: 20px;
    }

    .family-member img {
        width: 64px;
        height: 64px;
    }

    .profile h1 {
        font-size: 28px;
    }

    .form-page-header h1,
    .signin-header h1 {
        font-size: 32px;
    }

    /* Mobile Theme Toggle - Circular Button */
    .theme-toggle-track {
        min-width: 40px !important;
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        justify-content: center;
        align-items: center;
    }

    .theme-toggle-text {
        display: none !important;
    }

    .theme-toggle-knob {
        position: static !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        border-radius: 50% !important;
    }

    .theme-toggle-light .theme-toggle-knob {
        background: white !important;
        box-shadow: 
            3px 3px 6px rgba(0, 0, 0, 0.2),
            -3px -3px 6px rgba(255, 255, 255, 0.8);
        color: #2c3e50;
    }

    .theme-toggle-dark .theme-toggle-knob {
        background: #2c3e50 !important;
        box-shadow: 
            3px 3px 6px rgba(0, 0, 0, 0.4),
            -3px -3px 6px rgba(255, 255, 255, 0.1);
        color: #e0e0e0;
    }

    .theme-toggle-light .theme-toggle-track {
        background: white !important;
        box-shadow: 
            3px 3px 6px rgba(0, 0, 0, 0.2),
            -3px -3px 6px rgba(255, 255, 255, 0.8);
    }

    .theme-toggle-dark .theme-toggle-track {
        background: #2c3e50 !important;
        box-shadow: 
            3px 3px 6px rgba(0, 0, 0, 0.4),
            -3px -3px 6px rgba(255, 255, 255, 0.1);
    }

    .theme-toggle-icon {
        width: 28px !important;
        height: 28px !important;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
