/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navbar Styles */
.navbar {
    background: #ffffff;
    padding: 0 2rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
}

.main-content {
    flex: 1;
    margin-top: 60px; /* Offset for fixed navbar */
}

.nav-brand {
    font-weight: bold;
    font-size: 1.25rem;
    text-decoration: none;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    gap: 1.5rem;
}

.nav-item {
    position: relative;
}

.nav-link {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    padding: 0.5rem 0;
}

.nav-link:hover {
    color: #007bff;
}

/* Dropdown */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    display: none;
    z-index: 1000;
    padding: 0.5rem 0;
}

.nav-item:hover .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    color: #444;
    font-size: 0.95rem;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid #eee;
}

.btn-logout {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
}

/* Tabs */
.tabs-container {
    margin-top: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.tabs-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
    padding: 1rem 2rem;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: #007bff;
    background: #f0f4f8;
}

.tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background: #fff;
}

.tab-content {
    padding: 2rem;
    display: none;
}

.tab-content.active {
    display: block;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group-full {
    grid-column: span 2;
}

.setting-form-group {
    margin-bottom: 1rem;
}

.setting-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.setting-form-group input, .setting-form-group textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.btn-save {
    padding: 0.75rem 2rem;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.btn-save:hover {
    background: #218838;
}

/* Search & Pagination */
.search-container {
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.btn-search {
    padding: 0.75rem 1.5rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

/* Card Grid Styles */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.member-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.member-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.member-card-header {
    height: 180px;
    background: #f8f9fa;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.member-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.member-card-body {
    padding: 1.5rem;
    flex: 1;
}

.member-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.25rem;
}

.member-username {
    color: #007bff;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.member-info-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: #666;
    font-size: 0.85rem;
}

.member-info-row i {
    color: #999;
}

.pagination {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    gap: 5px;
}

.pagination li {
    display: inline-block;
}

.pagination li a, .pagination li span {
    display: block;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #007bff;
    border-radius: 4px;
    background: #fff;
}

.pagination li.active span, .pagination li.active a {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination li.disabled span {
    color: #ccc;
    background: #f9f9f9;
}

.pagination li a:hover:not(.active) {
    background-color: #f0f4f8;
}

nav[role="navigation"] {
    display: flex;
    justify-content: center;
}

nav svg {
    width: 20px;
}

.hidden.sm\:flex-1.sm\:flex.sm\:items-center.sm\:justify-between {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

/* Icon Styles */
.social-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

/* Console Styles */
.console-container {
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    border-radius: 8px;
    margin-top: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
}

.console-header {
    background: #333;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
}

.console-body {
    padding: 1rem;
    height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.console-log {
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 1rem;
    flex: 1;
}

.console-input-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #252526;
    padding: 0.5rem 1rem;
    border-top: 1px solid #444;
}

.console-prompt {
    color: #569cd6;
    font-weight: bold;
}

.console-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ce9178;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
}

.tool-selector {
    background: #3c3c3c;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    outline: none;
}

/* Home Page Fluid Layout */
.home-container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Ensure the main container in Layout/app.blade.php doesn't restrict home page */
.home-container-fluid-wrapper .container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Landing Page Responsive Adjustments */
@media (max-width: 768px) {
    /* Navbar Responsive Adjustments */
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 0.75rem 1rem;
    }
    
    .navbar > div[style*="display: flex"] {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem !important;
    }
    
    .nav-brand {
        justify-content: center;
        margin-bottom: 0.25rem;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1rem;
        width: 100%;
    }

    .dropdown-menu {
        min-width: 180px;
        left: 50%;
        transform: translateX(-50%);
    }

    .nav-auth {
        width: 100%;
        justify-content: center;
        border-left: none;
        border-top: 1px solid #eee;
        margin-left: 0;
        padding-left: 0;
        padding-top: 0.75rem;
        margin-top: 0.5rem;
    }
    
    .nav-auth .dropdown-menu {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }

    .main-content {
        margin-top: 130px; 
    }

    /* General responsive padding fix for non-tree pages */
    body:not(.family-tree-page) .main-content {
        margin-top: 130px !important;
    }

    /* -- HOME (FAMILY TREE) PAGE RESPONSIVENESS -- */
    .tree-viewport {
        height: calc(100vh - 130px) !important;
    }

    .controls-panel {
        top: auto !important;
        bottom: 20px !important;
        left: 50% !important;
        transform: translateX(-50%);
        right: auto !important;
        justify-content: center;
        padding: 6px !important;
        border-radius: 12px !important;
        width: max-content;
        max-width: calc(100vw - 20px);
        box-sizing: border-box;
        z-index: 1000 !important;
        flex-wrap: wrap;
    }

    .detail-sidebar {
        width: 100% !important;
        max-width: 100vw !important;
        padding: 1.5rem !important;
    }

    .control-divider {
        margin: 0 2px !important;
    }
    
    .control-btn.primary {
        padding: 0 10px !important;
        font-size: 0.75rem !important;
    }

    /* Language Switcher */
    div[style*="top: 1.5rem; right: 1.5rem;"] {
        top: 1rem !important;
        right: 1rem !important;
    }

    /* Main Container Padding */
    main.container > div[style*="padding: 3rem 1rem"] {
        padding: 2rem 1rem !important;
    }

    /* Family Name Header */
    main.container > div[style*="padding: 3rem 1rem"] > h1 {
        font-size: 1.8rem !important;
        margin-bottom: 0.5rem !important;
    }

    /* Description */
    main.container > div[style*="padding: 3rem 1rem"] > p {
        font-size: 1rem !important;
    }

    /* Head of Family Block */
    main.container > div[style*="padding: 3rem 1rem"] > div[style*="max-width: 600px"] {
        padding: 1.5rem 1rem !important;
        margin: 1rem 0 !important;
    }

    /* Head of Family Flex/Image */
    main.container > div[style*="padding: 3rem 1rem"] > div[style*="max-width: 600px"] > div[style*="display: flex"] {
        flex-direction: column !important;
        text-align: center !important;
        gap: 1rem !important;
    }

    /* Head of Family Image Size Adjustment */
    main.container > div[style*="padding: 3rem 1rem"] > div[style*="max-width: 600px"] > div[style*="display: flex"] > img {
        width: 100px !important;
        height: 100px !important;
    }
    
    /* Login button inside block (for when setting is null) */
    main.container > div[style*="padding: 3rem 1rem"] > div[style*="max-width: 400px"] {
        padding: 1.5rem !important;
    }

    /* Credits Section */
    main.container > div[style*="padding: 3rem 1rem"] > div[style*="display: grid"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 1.5rem !important;
        margin-top: 2rem !important;
    }
}

@media (max-width: 480px) {
    /* Credits Section for smaller phones */
    main.container > div[style*="padding: 3rem 1rem"] > div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
    }
}