/* ===================================
   Global Styles
   =================================== */

:root {
    /* Color Palette */
    --primary-color: #2196F3;
    --secondary-color: #757575;
    --success-color: #4CAF50;
    --danger-color: #F44336;
    --warning-color: #FF9800;

    /* Gender Colors */
    --male-border: #2196F3;
    --male-bg: #E3F2FD;
    --female-border: #E91E63;
    --female-bg: #FCE4EC;
    --other-border: #757575;
    --other-bg: #F5F5F5;

    /* Status Colors */
    --living-color: #4CAF50;
    --deceased-overlay: rgba(0, 0, 0, 0.1);

    /* Connection Lines */
    --line-color: #BDBDBD;

    /* Typography */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 300ms ease-in-out;
    --transition-slow: 500ms ease-in-out;
}

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

body {
    font-family: var(--font-family);
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===================================
   Header
   =================================== */

.header {
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header h1 {
    font-weight: 600;
    color: #212529;
}

/* ===================================
   Main Content
   =================================== */

.main-content {
    flex: 1;
}

/* ===================================
   Loading States
   =================================== */

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* ===================================
   Footer
   =================================== */

.footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

/* ===================================
   Buttons
   =================================== */

.btn {
    font-weight: 500;
    transition: all var(--transition-fast);
    border-radius: 0.375rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

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

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #1976D2;
    border-color: #1976D2;
}

/* ===================================
   Forms
   =================================== */

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(33, 150, 243, 0.25);
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.invalid-feedback {
    display: block;
    margin-top: 0.25rem;
}

/* ===================================
   Modals
   =================================== */

.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.modal-footer {
    border-top: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.modal-title {
    font-weight: 600;
    color: #212529;
}

/* ===================================
   Alerts
   =================================== */

.alert {
    border: none;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
}

/* ===================================
   Badges
   =================================== */

.badge {
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
}

/* ===================================
   Toast Notifications
   =================================== */

.toast {
    border: none;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.toast-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

/* ===================================
   Profile Photo Upload
   =================================== */

.profile-photo-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #f8f9fa;
    position: relative;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview i {
    color: #bdbdbd;
}

/* ===================================
   Context Menu
   =================================== */

.context-menu {
    position: fixed;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    min-width: 200px;
    z-index: 10000;
    animation: fadeIn 0.15s ease-in-out;
}

.context-menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.95rem;
    color: #212529;
}

.context-menu-item:hover {
    background-color: #f8f9fa;
}

.context-menu-item i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.context-menu-item.male i {
    color: var(--male-border);
}

.context-menu-item.female i {
    color: var(--female-border);
}

.context-menu-item.partner i {
    color: var(--primary-color);
}

/* ===================================
   Death Fields Toggle
   =================================== */

.death-field {
    display: none;
}

.death-field.show {
    display: block;
}

/* ===================================
   Animations
   =================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-5px);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ===================================
   Utility Classes
   =================================== */

.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    /* -webkit-line-clamp: 2; */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.25rem;
    }

    .modal-lg {
        max-width: 95%;
    }

    .photo-preview {
        width: 100px;
        height: 100px;
    }
}

/* ===================================
   Accessibility
   =================================== */

.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --line-color: #000000;
    }

    .card {
        border: 2px solid #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
