/**
 * main.css – Koncreet™ Global Styles
 * Modern, accessible, responsive, dark-mode ready
 * Optimized for field use on mobile + desktop
 * 2025 Web Standards: CSS Nesting, :has(), prefers-reduced-motion
 */

:root {
    /* === KONCREET™ BRAND COLORS === */
    --kc-primary: #16365c;
    --kc-primary-dark: #0d4ae6;
    --kc-success: #10b981;
    --kc-success-dark: #059669;
    --kc-danger: #ef4444;
    --kc-warning: #f59e0b;
    --kc-dark: #0f172a;
    --kc-gray: #64748b;
    --kc-light: #f8fafc;
    --kc-bg: #ffffff;
    --kc-bg-alt: #f1f5f9;
    --kc-border: #e2e8f0;
    --kc-radius: 0.75rem;
    --kc-radius-lg: 1rem;
    --kc-shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --kc-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --kc-shadow-md: 0 10px 25px -5px rgba(0,0,0,0.1);
    --kc-shadow-lg: 0 20px 40px -10px rgba(0,0,0,0.15);
    --kc-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --kc-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* === DARK MODE === */
.dark-mode,
@media (prefers-color-scheme: dark) {
    :root {
        --kc-bg: #0f172a;
        --kc-bg-alt: #1e293b;
        --kc-dark: #f8fafc;
        --kc-gray: #94a3b8;
        --kc-border: #334155;
        --kc-light: #1e293b;
    }

    body {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
        color: #e2e8f0;
    }

    .card, .navbar {
        background: var(--kc-bg-alt);
        border-color: var(--kc-border);
    }

    .form-control, .form-select {
        background: var(--kc-bg-alt);
        border-color: var(--kc-border);
        color: var(--kc-dark);
    }

    .form-control:focus, .form-select:focus {
        border-color: var(--kc-primary);
        box-shadow: 0 0 0 0.2rem rgba(26, 95, 255, 0.25);
    }

    .text-muted { color: #94a3b8 !important; }
    .text-dark { color: #e2e8f0 !important; }
    .bg-light { background: var(--kc-bg-alt) !important; }
}

/* === RESET & BASE === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--kc-font);
    background: linear-gradient(135deg, #f0f7ff 60%, #e0eaff 100%);
    color: var(--kc-dark);
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    color: var(--kc-dark);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.1rem; }

p { margin-bottom: 1rem; }
small, .small { font-size: 0.875rem; }

.text-primary { color: var(--kc-primary) !important; }
.text-success { color: var(--kc-success) !important; }
.text-danger { color: var(--kc-danger) !important; }
.text-muted { color: var(--kc-gray) !important; }

/* === LAYOUT === */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 576px) { .container { padding: 0 1.5rem; } }
@media (min-width: 768px) { .container { padding: 0 2rem; } }

/* === NAVBAR === */
.navbar {
    background: var(--kc-bg);
    box-shadow: var(--kc-shadow-sm);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--kc-primary) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand small {
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--kc-gray);
}

/* === CARDS === */
.card {
    background: var(--kc-bg);
    border: 1px solid var(--kc-border);
    border-radius: var(--kc-radius-lg);
    box-shadow: var(--kc-shadow-md);
    transition: var(--kc-transition);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--kc-shadow-lg);
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.card-text {
    font-size: 0.95rem;
    color: var(--kc-gray);
}

/* === FOCUS & INTERACTIONS === */
:focus-visible {
    outline: 2px solid var(--kc-primary);
    outline-offset: 2px;
}

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

.btn-primary:hover {
    background: var(--kc-primary-dark);
    border-color: var(--kc-primary-dark);
    transform: translateY(-1px);
}

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

.btn-outline-primary:hover {
    background: var(--kc-primary);
    color: white;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--kc-success);
    color: white;
    border-color: var(--kc-success);
}

.btn-success:hover {
    background: var(--kc-success-dark);
    border-color: var(--kc-success-dark);
}

/* Loading state */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === FORMS === */
.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--kc-dark);
    background-color: var(--kc-bg);
    background-clip: padding-box;
    border: 1px solid var(--kc-border);
    border-radius: var(--kc-radius);
    transition: var(--kc-transition);
    appearance: none;
}

.form-control:focus,
.form-select:focus {
    color: var(--kc-dark);
    background-color: var(--kc-bg);
    border-color: var(--kc-primary);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(26, 95, 255, 0.15);
}

.form-control::placeholder,
.form-select::placeholder {
    color: var(--kc-gray);
    opacity: 0.7;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--kc-danger);
    background-image: none;
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--kc-danger);
}

.was-validated .form-control:invalid ~ .invalid-feedback,
.was-validated .form-select:invalid ~ .invalid-feedback,
.form-control.is-invalid ~ .invalid-feedback,
.form-select.is-invalid ~ .invalid-feedback {
    display: block;
}

/* === UTILITIES === */
.spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
    color: var(--kc-primary);
}

.shadow-sm { box-shadow: var(--kc-shadow-sm); }
.shadow { box-shadow: var(--kc-shadow); }
.shadow-md { box-shadow: var(--kc-shadow-md); }
.shadow-lg { box-shadow: var(--kc-shadow-lg); }

.rounded { border-radius: var(--kc-radius); }
.rounded-lg { border-radius: var(--kc-radius-lg); }

.text-center { text-align: center; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Touch targets */
.asset-item, .asset-photo {
    touch-action: none;
    -webkit-user-drag: none;
    user-select: none;
}

.asset-item[aria-grabbed="true"],
.asset-photo[aria-grabbed="true"] {
    opacity: 0.8;
    transform: scale(0.98);
}

/* Focus ring for keyboard users */
.asset-item:focus-visible,
.asset-photo:focus-visible {
    outline: 3px solid var(--kc-primary);
    outline-offset: 2px;
}

@media (prefers-contrast: high) {
    :root {
        --kc-border: #000;
    }
    .card, .navbar {
        border: 2px solid #000;
    }
}

/* === PRINT STYLES === */
@media print {
    .navbar, .btn, .card:hover {
        box-shadow: none !important;
        transform: none !important;
    }
    body { background: white; }
}

/* === ASSET-SPECIFIC STYLES (Added for consistency with app.js & dashboard.html) === */
.asset-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.asset-item {
    background: var(--kc-bg-alt);
    border: 1px solid var(--kc-border);
    border-radius: var(--kc-radius);
    margin-bottom: 1rem;
    padding: 1rem;
    transition: var(--kc-transition);
}

.asset-item:hover {
    border-color: var(--kc-primary);
}

.asset-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.asset-photo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--kc-radius);
    box-shadow: var(--kc-shadow-sm);
}

/* === RESPONSIVE ADDITIONS === */
@media (max-width: 576px) {
    h1 { font-size: 2rem; }
    .card-body { padding: 1rem; }
    .asset-photo { width: 100px; height: 100px; }
}

/* === PROGRESSIVE LOADER (Added for ph.html and global use) === */
.loader {
    width: 180px;  /* Editable width */
    height: 7px;  /* Editable height */
    border-radius: 10px;  /* Editable radius */
    color: var(--kc-primary);  /* Editable color (uses primary) */
    border: 1px solid;  /* Editable border */
    position: relative;
    overflow: hidden;  /* Prevent overflow */
}


