* {
    box-sizing: border-box;
    max-width: 100%;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
}

:root {
    /* Nordic Minimalist Light Theme Vibe */
    --bg-color: #f1f5f9; /* Slate 100 - Clean app background */
    --text-color: #0f172a; /* Slate 900 */
    --text-secondary: #475569; /* Slate 600 */
    
    --glass-bg: #ffffff; /* pure white cards */
    --glass-border: rgba(0, 0, 0, 0.05); /* very soft subtle lines */
    
    --primary-color: #0ea5e9; /* Sky blue */
    --secondary-color: #10b981; /* Emerald */
    --error-color: #ef4444;
    --success-color: #10b981;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #0ea5e9 0%, #10b981 100%);
    
    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Shadows Minimalist */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-color);
}

/* Removed Background Orbs */




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

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.06);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--secondary-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Soft Minimalist Card */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    grid-gap: 20px;
    margin-bottom: 25px;
    width: 100%;
}

.widget-card {
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: auto;
    min-height: 180px;
    min-width: 0;
    /* CRITICAL for grid children with long content */
    overflow: hidden;
}


.widget-card h4 {
    margin: 0 0 15px 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 10px 0;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}


/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    min-width: 0;
    max-width: 100%;
    /* Fixes grid overflow */
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="url"],
input[type="search"],
select,
textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #f8fafc;
    color: var(--text-color);
    font-size: 16px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

/* Custom File Upload */
.file-upload {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.file-upload:hover .file-upload-label {
    border-color: var(--primary-color);
    background: #f1f5f9;
    color: var(--primary-color);
}

.file-upload-filename {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
    display: block;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Custom Graphical Checkboxes */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    vertical-align: middle;
    margin: 0;
    flex-shrink: 0;
}

input[type="checkbox"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid #000;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:hover {
    border-color: var(--primary-color);
    background: #f1f5f9;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-body);
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background: var(--text-color);
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    background: #334155;
}

.btn-block {
    width: 100%;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-color);
    display: flex;
    align-items: center;
    position: relative;
    height: 40px;
    /* Constrain container height */
}

.logo-img {
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9)) brightness(1.3);
    animation: neon-pulse 2s infinite ease-in-out;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    /* Let clicks pass to the link if needed */
}

@keyframes neon-pulse {

    0%,
    100% {
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8)) brightness(1.2);
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 0 15px rgba(255, 255, 255, 1)) brightness(1.5);
        transform: scale(1.05);
    }
}

.nav-links a {
    margin-left: 20px;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Alerts */
.alert {
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid var(--error-color);
    color: #b91c1c;
}

.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid var(--success-color);
    color: #065f46;
}

/* Type Selectors (Cards with icons) */
.type-selector .type-option {
    cursor: pointer;
}

.type-selector .type-card {
    background: #f1f5f9;
    border: 2px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 15px 5px;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.type-selector .type-card i {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.type-selector .type-card span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.type-selector input:checked+.type-card {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary-color);
}

.type-selector input:checked+.type-card i {
    color: var(--primary-color);
}

.type-selector input:checked+.type-card span {
    color: var(--primary-color);
    font-weight: 600;
}

/* FAB Menu (Tabs Replacement) */
.fab-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.fab-menu {
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 20px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 5px;
    /* Hide scrollbar for cleaner look but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.fab-menu::-webkit-scrollbar {
    display: none;
}

.fab-menu.show {
    display: flex;
}

.fab-item {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: var(--text-color);
}

.fab-label {
    background: #ffffff;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
    color: var(--text-color);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.fab-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    color: var(--text-color);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: 0.3s;
}

.fab-item:hover .fab-icon {
    background: #f8fafc;
    color: var(--primary-color);
}

.fab-item.active .fab-icon {
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

.fab-item.active .fab-label {
    font-weight: bold;
    color: var(--primary-color);
}

.fab-main {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
    color: #ffffff;
    font-size: 1.5rem;
    border: none;
    outline: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s;
}

.fab-main.open {
    transform: rotate(90deg);
}

.fab-main:hover {
    transform: scale(1.05);
}

.fab-main.open:hover {
    transform: rotate(90deg) scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .glass-card {
        padding: 1rem;
    }

    .modal {
        padding: 10px !important;
        align-items: flex-start !important;
        overflow-y: auto;
        overflow-x: hidden;
        max-width: 100vw;
    }

    .modal .glass-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: auto;
        padding: 15px;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .modal form,
    .modal input,
    .modal select,
    .modal textarea {
        max-width: 100%;
        box-sizing: border-box;
    }

    .fab-container {
        bottom: 20px;
        right: 20px;
    }
}

/* Global Responsive Grid Utilities */
.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.grid-3-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.grid-4-col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.grid-time-title {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 10px;
}

/* Prevent grid blowout by forcing grid items to shrink below their minimum content size */
.grid-2-col>*,
.grid-3-col>*,
.grid-4-col>*,
.grid-time-title>* {
    min-width: 0;
}

@media (max-width: 600px) {

    .grid-2-col,
    .grid-3-col,
    .grid-4-col,
    .grid-time-title {
        grid-template-columns: 1fr;
    }

    .form-buttons-mobile {
        flex-direction: column;
        flex-wrap: wrap;
    }

    .form-buttons-mobile button {
        width: 100%;
    }

    .item-actions {
        position: static !important;
        opacity: 1 !important;
        justify-content: flex-start;
        margin-top: 15px;
    }

    .timeline-title {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 5px;
    }
}