/* ============================================================================
   Custom Styles — simplephp-template
   ============================================================================ */

/* --- General --- */
:root {
    --app-primary: #0b5ed7;
    --app-primary-dark: #084298;
    --app-surface: #ffffff;
    --app-page: #f5f7fb;
    --app-text-muted: #5f6b7a;
    --app-focus: rgba(13, 110, 253, 0.35);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--app-page);
    color: #1f2937;
}

main {
    flex: 1 0 auto;
}

.footer {
    flex-shrink: 0;
}

/* --- Navbar --- */
.navbar-brand {
    letter-spacing: 0.5px;
}

.navbar {
    background: linear-gradient(115deg, #172033, #263957) !important;
}

.navbar .nav-link {
    border-radius: 0.375rem;
    padding-inline: 0.75rem !important;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus-visible {
    background: rgba(255, 255, 255, 0.12);
}

.skip-link {
    background: #fff;
    border-radius: 0 0 0.375rem 0;
    color: #084298;
    left: 0;
    padding: 0.75rem 1rem;
    position: fixed;
    top: -4rem;
    transition: top 0.15s ease;
    z-index: 2000;
}

.skip-link:focus {
    top: 0;
}

:focus-visible {
    outline: 3px solid var(--app-focus);
    outline-offset: 2px;
}

/* --- Cards --- */
.card {
    border: none;
    border-radius: 0.75rem;
    background: var(--app-surface);
}

.card .card-title {
    font-weight: 700;
}

/* --- Forms --- */
.form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

/* --- Buttons --- */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    min-height: 42px;
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* --- Alerts --- */
.alert {
    border: none;
    border-radius: 0.5rem;
}

/* --- Tables --- */
.table th {
    font-weight: 600;
    background-color: #f8f9fa;
    border-bottom-width: 2px;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.04);
}

/* --- Dashboard cards --- */
.dashboard-stat {
    transition: transform 0.2s ease;
}

.dashboard-stat:hover {
    transform: translateY(-3px);
}

.auth-layout {
    min-height: calc(100vh - 185px);
    align-items: center;
}

.auth-card {
    box-shadow: 0 1rem 2.5rem rgba(31, 41, 55, 0.12) !important;
}

.auth-card .card-header-icon {
    align-items: center;
    background: rgba(13, 110, 253, 0.1);
    border-radius: 50%;
    color: var(--app-primary);
    display: inline-flex;
    font-size: 1.25rem;
    height: 3rem;
    justify-content: center;
    width: 3rem;
}

.password-field .btn {
    min-width: 4.5rem;
}

.help-guide .accordion-item {
    border-color: #e3e8ef;
}

.help-guide .accordion-button:not(.collapsed) {
    background: #edf4ff;
    color: var(--app-primary-dark);
}

/* --- Auth pages --- */
.auth-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* --- Mobile-friendly touch targets --- */
@media (pointer: coarse) {
    .btn, .nav-link, .dropdown-item, .form-check-label {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .btn-sm {
        min-height: 44px;
    }

    .form-control, .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .navbar-toggler {
        min-height: 44px;
        min-width: 44px;
    }
}

/* --- Navbar mobile --- */
.navbar-toggler:focus {
    box-shadow: none;
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 2px;
}

/* --- Responsive tables (non-DataTables) --- */
.table-responsive-stack {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- Card grid improvements --- */
@media (max-width: 768px) {
    .row.g-3 > [class*="col-"] {
        margin-bottom: 0.5rem;
    }
}

/* --- Buttons: full-width on small screens --- */
@media (max-width: 576px) {
    .btn-mobile-block {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.5rem; }
    h3, .h3 { font-size: 1.25rem; }

    .display-4 {
        font-size: 2rem;
    }

    .lead {
        font-size: 1rem;
    }

    /* Stack form actions vertically on mobile */
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Table overflow wrapper */
    .table-responsive-mobile {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

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

/* --- Medium screens (tablets) --- */
@media (max-width: 992px) {
    .navbar .dropdown-menu {
        border: none;
        background: transparent;
        padding-left: 1rem;
    }

    .navbar .dropdown-menu .dropdown-item {
        color: rgba(255,255,255,0.75);
    }

    .navbar .dropdown-menu .dropdown-item:hover {
        background: transparent;
        color: #fff;
    }

    .navbar .dropdown-divider {
        border-color: rgba(255,255,255,0.15);
    }
}

/* --- Disable AOS animations on mobile (reduces jank) --- */
@media (max-width: 768px) {
    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }

    [data-aos].aos-animate {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* --- Print styles --- */
@media print {
    .navbar, .footer, .btn, .alert-dismissible .btn-close {
        display: none !important;
    }

    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }

    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* Card pages */
.public-profile-page { background: radial-gradient(circle at 10% 0%, #e1eeed 0, transparent 34%), #f2f5f5; color: #172f3d; }
.public-profile { min-height: 100vh; max-width: 900px; display: flex; flex-direction: column; justify-content: center; padding: 40px 20px 64px; }
.public-profile #public-message { width: 100%; max-width: 760px; margin-inline: auto; }
.public-profile .business-card { width: 100%; max-width: 760px; overflow: hidden; border: 1px solid #dce7e8; border-radius: 24px; box-shadow: 0 28px 70px rgba(15, 43, 57, .12); }
.profile-cover { height: 158px; position: relative; overflow: hidden; background: linear-gradient(115deg, #102b3c 5%, #16465a 65%, #1c6d70); }
.profile-cover::before { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 55%, rgba(255, 255, 255, .07) 55%, rgba(255, 255, 255, .07) 66%, transparent 66%); }
.profile-cover::after { content: ''; position: absolute; left: 0; bottom: 0; width: 28%; height: 4px; background: #73d7c0; }
.profile-cover-ring { position: absolute; width: 360px; height: 360px; right: -70px; top: -170px; border: 1px solid rgba(255, 255, 255, .17); border-radius: 50%; }
.profile-cover-ring::after { content: ''; position: absolute; inset: 38px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 50%; }
.profile-content { padding: 0 48px 46px; }
.profile-identity { position: relative; margin-top: -63px; }
.profile-photo { width: 126px; height: 126px; overflow: hidden; border: 6px solid #fff; border-radius: 22px; background: #dcefeb; box-shadow: 0 9px 24px rgba(9, 40, 51, .16); }
.profile-avatar, .profile-initials { width: 100%; height: 100%; object-fit: cover; }
.profile-initials { display: grid; place-items: center; color: #174f57; font-size: 2.3rem; font-weight: 700; letter-spacing: -.06em; }
.profile-heading { margin-top: 22px; }
.profile-company { margin: 0 0 6px; color: #237e78; font-size: .76rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.profile-name { margin: 0; color: #102b3c; font-size: clamp(2rem, 5vw, 3rem); font-weight: 750; letter-spacing: -.045em; line-height: 1.12; overflow-wrap: anywhere; }
.profile-headline { margin: 10px 0 0; color: #526876; font-size: 1.08rem; line-height: 1.5; }
.profile-bio { max-width: 62ch; margin: 26px 0 0; padding-top: 22px; border-top: 1px solid #e4ebed; color: #435865; line-height: 1.7; white-space: pre-line; }
.profile-company:empty, .profile-headline:empty, .profile-bio:empty { display: none; }
.profile-actions-panel { margin-top: 30px; padding: 20px; border: 1px solid #e1e9e9; border-radius: 18px; background: #f7faf9; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.profile-actions > * { flex: 1 1 170px; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; font-weight: 650; border-radius: 10px; }
.profile-actions > :first-child { flex-basis: 100%; }
.profile-actions .btn-primary { background: #102b3c; border-color: #102b3c; }
.profile-actions .btn-primary:hover, .profile-actions .btn-primary:focus { background: #1c5365; border-color: #1c5365; }
.profile-actions .btn-success { background: #1c806b; border-color: #1c806b; }
.profile-actions .btn-success:hover, .profile-actions .btn-success:focus { background: #146e5b; border-color: #146e5b; }
.profile-actions .btn-outline-primary { color: #164a59; border-color: #bdd0d1; background: #fff; }
.profile-actions .btn-outline-primary:hover, .profile-actions .btn-outline-primary:focus { color: #fff; border-color: #164a59; background: #164a59; }
.profile-media-section { margin-top: 38px; padding-top: 24px; border-top: 1px solid #e4ebed; }
.profile-section-title { margin: 0 0 18px; color: #102b3c; font-size: 1.12rem; font-weight: 700; letter-spacing: -.015em; }
.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.media-tile { display: flex; flex-direction: column; gap: .5rem; min-height: 82px; padding: 18px; border: 1px solid #dce6e8; border-radius: 14px; color: #153d4c; background: #fff; font-weight: 650; text-decoration: none; overflow-wrap: anywhere; transition: border-color .15s, box-shadow .15s; }
.media-tile:hover, .media-tile:focus { border-color: #83b9b4; box-shadow: 0 7px 18px rgba(18, 72, 77, .08); color: #0e5962; }
.media-tile small { color: #71838a; font-size: .68rem; font-weight: 700; letter-spacing: .12em; }
.media-thumb { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; }
.media-video { grid-column: 1 / -1; }
.media-video iframe, .media-video video { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 9px; background: #000; }
.media-video-link { color: #176d70; font-size: .9rem; text-decoration: none; }
.media-video-link:hover, .media-video-link:focus { text-decoration: underline; }
.editor-shell { max-width: 1150px; }
@media (max-width: 575px) {
    .public-profile { padding: 16px 12px 36px; }
    .public-profile .business-card { border-radius: 18px; }
    .profile-cover { height: 132px; }
    .profile-content { padding: 0 22px 30px; }
    .profile-identity { margin-top: -52px; }
    .profile-photo { width: 104px; height: 104px; border-width: 5px; border-radius: 19px; }
    .profile-initials { font-size: 1.9rem; }
    .profile-heading { margin-top: 18px; }
    .profile-headline { font-size: 1rem; }
    .profile-bio { margin-top: 20px; padding-top: 18px; }
    .profile-actions-panel { margin-top: 24px; padding: 16px; }
    .media-grid { grid-template-columns: minmax(0, 1fr); }
}
