:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #F3F4F6;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --error-color: #EF4444;
    --success-color: #10B981;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    padding: 2rem;
}

.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
    box-sizing: border-box;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-box {
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h1 {
    margin-top: 0;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    text-decoration: none;
    text-align: center;
}

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

.btn:active {
    transform: scale(0.98);
}

.btn-block {
    width: 100%;
}

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

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

.btn-danger {
    background-color: var(--error-color);
}

.btn-danger:hover {
    background-color: #DC2626;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.alert-error {
    background-color: #FEF2F2;
    color: var(--error-color);
    border: 1px solid #F87171;
}

.alert-success {
    background-color: #ECFDF5;
    color: var(--success-color);
    border: 1px solid #34D399;
}

/* Dashboard styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.header h2 {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.header-actions .btn {
    padding: 0.6rem 1.1rem;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

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

.stat-cards {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stat-card .title {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 0.5rem;
}

.table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: rgba(243, 244, 246, 0.5);
    font-weight: 600;
    color: var(--text-muted);
}

tr:hover {
    background-color: rgba(243, 244, 246, 0.5);
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
}

/* Form Styles */
.form-section {
    margin-bottom: 2.5rem;
}

.form-section-bg {
    background: rgba(255, 255, 255, 0.4);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.current-file {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.form-section h3, .form-section-bg h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
}

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

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

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

#family-members-container {
    display: grid;
    grid-template-columns: minmax(140px, 1.8fr) 75px minmax(110px, 1.2fr) minmax(105px, 1.1fr) 55px minmax(160px, 1.7fr) minmax(160px, 1.7fr) 36px;
    min-width: 960px;
    gap: 0.6rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    padding: 1.25rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    box-sizing: border-box;
}

.family-member-header {
    display: contents;
}

.family-member-header > div {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.family-member-row {
    display: contents;
}

.family-member-row > input, 
.family-member-row > select {
    width: 100%;
    margin: 0;
    font-size: 0.85rem;
    padding: 0.55rem 0.5rem;
    box-sizing: border-box;
}

.family-member-row > .btn-icon {
    margin: 0 auto;
}

/* Avatar Styles */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Enhanced Table Styles */
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

th {
    background-color: rgba(249, 250, 251, 0.8);
    padding: 1.25rem 1rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

tr {
    transition: background-color 0.2s ease, transform 0.2s ease;
}

tr:hover {
    background-color: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.name-cell {
    font-weight: 600;
    color: var(--primary-color);
}

/* Icon Buttons */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background-color: #FEE2E2;
    color: var(--error-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background-color: var(--error-color);
    color: white;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Responsive Design */
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

@media (max-width: 992px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .glass-panel {
        padding: 1rem;
    }
    
    .form-section-bg {
        padding: 1rem;
    }
    
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .grid-2 > div, .grid-3 > div, .form-group[style*="span"] {
        grid-column: span 1 !important;
    }
    
    .header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 1.25rem;
    }

    .header-actions {
        justify-content: center;
        gap: 0.5rem;
    }

    .header-actions .btn {
        flex: 1 1 calc(50% - 0.5rem);
        justify-content: center;
        text-align: center;
    }
    
    .stat-cards {
        flex-direction: column;
        gap: 1rem;
    }
    
    #family-members-container {
        display: flex;
        flex-direction: column;
        min-width: 0 !important;
        background: transparent;
        padding: 0;
        border: none;
    }
    
    .family-member-header {
        display: none;
    }
    
    .family-member-row {
        display: flex;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.9);
        padding: 1.5rem;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        position: relative;
        box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    }
    
    .family-member-row > input,
    .family-member-row > select {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .family-member-row > .btn-icon {
        position: absolute;
        top: 1rem;
        right: 1rem;
        margin: 0;
        background-color: var(--error-color);
        color: white;
    }
    
    /* Table to Card Mobile View */
    table {
        border: 0;
    }
    
    table thead {
        display: none;
    }
    
    table tr {
        display: block;
        margin-bottom: 1.5rem;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 12px;
        box-shadow: 0 6px 15px rgba(0,0,0,0.05);
        border: 1px solid var(--border-color);
        padding: 1rem;
    }
    
    table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed var(--border-color);
        padding: 0.75rem 0;
        text-align: right;
    }
    
    table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 0.75rem;
        text-align: left;
        margin-right: 1rem;
        flex-shrink: 0;
    }
    
    table td:last-child {
        border-bottom: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    table td:last-child::before {
        display: none;
    }
    
    .actions {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    
    .actions .btn {
        width: 100%;
    }
    
    .login-box {
        padding: 2rem 1.5rem;
    }
}

/* Prominent Submit Bar Styles */
.submit-action-container {
    margin-top: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #4F46E5;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.15);
}

.btn-submit-main {
    display: inline-block;
    width: 100%;
    max-width: 480px;
    padding: 1.1rem 2rem;
    background: linear-gradient(135deg, #4F46E5 0%, #3730A3 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
    transition: all 0.3s ease;
    text-align: center;
}

.btn-submit-main:hover {
    background: linear-gradient(135deg, #4338CA 0%, #312E81 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.45);
}

.btn-submit-main:active {
    transform: translateY(1px);
}

.btn-submit-main:disabled {
    background: #9CA3AF !important;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

@media (max-width: 768px) {
    .submit-action-container {
        padding: 1rem;
        margin-top: 1.5rem;
    }
    .btn-submit-main {
        max-width: 100%;
        font-size: 1.1rem;
        padding: 1rem 1.5rem;
    }
}

/* Dashboard Search Bar Styles */
.dashboard-search-container {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 260px;
}

.search-input-wrapper input {
    width: 100%;
    padding: 0.85rem 2.8rem 0.85rem 2.75rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    outline: none;
    transition: all 0.25s ease;
    background: #FAFAFA;
}

.search-input-wrapper input:focus {
    border-color: var(--primary-color);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.search-clear-btn {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    background: #E5E7EB;
    color: #4B5563;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

.search-clear-btn:hover {
    background: #D1D5DB;
    color: #1F2937;
}

.search-info-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.search-count-badge {
    background: #EEF2FF;
    color: var(--primary-color);
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
}

@media (max-width: 640px) {
    .dashboard-search-container {
        padding: 0.85rem;
        flex-direction: column;
        align-items: stretch;
    }
    .search-input-wrapper {
        min-width: 100%;
    }
    .search-info-pill {
        justify-content: space-between;
    }
}

/* Toggle Switch Styles */
.status-toggle-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 30px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #D1D5DB;
    transition: .3s;
    border-radius: 30px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: #10B981;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.status-badge-open {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #DEF7EC;
    color: #03543F;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.status-badge-closed {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #FDE8E8;
    color: #9B1C1C;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.status-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-badge-open .status-badge-dot {
    background: #10B981;
}
.status-badge-closed .status-badge-dot {
    background: #E02424;
}


