/* ============================================================
   shared.css — Brand colors, sidebar layout, Bootstrap overrides
   Shared across all pages (except debug.html which is standalone)
   ============================================================ */

/* Self-hosted fonts (Open Sans + Roboto) */
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/open-sans-400.ttf') format('truetype');
}

@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/assets/fonts/open-sans-600.ttf') format('truetype');
}

@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/open-sans-700.ttf') format('truetype');
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/roboto-700.ttf') format('truetype');
}

/* Company Brand Colors */
:root {
    --tw-grey-600: 114 114 114;
    --tw-blue-200: 239 253 255;
    --tw-blue-400: 31 183 209;
    --tw-blue-600: 27 155 177;
    --tw-pink-400: 235 87 113;
    --tw-pink-600: 229 66 95;

    /* Bootstrap overrides */
    --bs-primary: rgb(var(--tw-blue-400));
    --bs-primary-rgb: var(--tw-blue-400);
    --bs-danger: rgb(var(--tw-pink-400));
    --bs-danger-rgb: var(--tw-pink-400);
    --bs-secondary: rgb(var(--tw-grey-600));
    --bs-secondary-rgb: var(--tw-grey-600);
    --bs-success: rgb(var(--tw-blue-600));
    --bs-success-rgb: var(--tw-blue-600);

    --sidebar-width: 280px;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    min-height: 100vh;
}

/* ========== SIDEBAR LAYOUT ========== */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: white;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.app-sidebar.collapsed {
    transform: translateX(-100%);
}

.app-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

.app-content.expanded {
    margin-left: 0;
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #1e293b;
    text-align: center;
}

.sidebar-logo:hover {
    color: #1e293b;
    opacity: 0.9;
}

.sidebar-logo img {
    height: 48px;
    width: auto;
    max-width: 200px;
}

.sidebar-logo-text {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
    background: rgb(var(--tw-blue-200) / 0.3);
    color: rgb(var(--tw-blue-600));
    border-left-color: rgb(var(--tw-blue-400));
}

.sidebar-nav-item.active {
    background: rgb(var(--tw-blue-200) / 0.5);
    color: rgb(var(--tw-blue-600));
    border-left-color: rgb(var(--tw-blue-400));
    font-weight: 600;
}

.sidebar-nav-icon {
    font-size: 1.5rem;
    width: 24px;
    text-align: center;
}

.sidebar-nav-text {
    flex: 1;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.sidebar-user {
    margin-bottom: 1rem;
}

.sidebar-user-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.sidebar-user-email {
    font-size: 0.75rem;
    color: #64748b;
    word-break: break-all;
}

.btn-logout {
    background: rgb(var(--tw-pink-400));
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    width: 100%;
}

.btn-logout:hover {
    background: rgb(var(--tw-pink-600));
    color: white;
}

/* Mobile Toggle */
.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem;
    display: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
}

.sidebar-toggle:hover {
    background: rgb(var(--tw-blue-200) / 0.3);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .app-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }
}

/* ========== BOOTSTRAP BUTTON OVERRIDES ========== */

.btn-primary {
    background-color: rgb(var(--tw-blue-400));
    border-color: rgb(var(--tw-blue-400));
    color: white;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: rgb(var(--tw-blue-600));
    border-color: rgb(var(--tw-blue-600));
    color: white;
}

.btn-primary:active,
.btn-primary.active,
.btn-primary:focus:active {
    background-color: rgb(var(--tw-blue-600)) !important;
    border-color: rgb(var(--tw-blue-600)) !important;
    color: white !important;
}

.btn-secondary {
    background-color: rgb(var(--tw-grey-600));
    border-color: rgb(var(--tw-grey-600));
    color: white;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: rgb(90, 90, 90);
    border-color: rgb(90, 90, 90);
    color: white;
}

.btn-secondary:active,
.btn-secondary.active,
.btn-secondary:focus:active {
    background-color: rgb(90, 90, 90) !important;
    border-color: rgb(90, 90, 90) !important;
    color: white !important;
}

.btn-outline-primary {
    color: rgb(var(--tw-blue-400));
    border-color: rgb(var(--tw-blue-400));
    background-color: transparent;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: rgb(var(--tw-blue-400));
    border-color: rgb(var(--tw-blue-400));
    color: white;
}

.btn-outline-primary:active,
.btn-outline-primary.active,
.btn-outline-primary:focus:active {
    background-color: rgb(var(--tw-blue-400)) !important;
    border-color: rgb(var(--tw-blue-400)) !important;
    color: white !important;
}

.btn-outline-danger {
    color: rgb(var(--tw-pink-400));
    border-color: rgb(var(--tw-pink-400));
    background-color: transparent;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
    background-color: rgb(var(--tw-pink-400));
    border-color: rgb(var(--tw-pink-400));
    color: white;
}

.btn-outline-danger:active,
.btn-outline-danger.active,
.btn-outline-danger:focus:active {
    background-color: rgb(var(--tw-pink-600)) !important;
    border-color: rgb(var(--tw-pink-600)) !important;
    color: white !important;
}

.btn-danger {
    background-color: rgb(var(--tw-pink-400));
    border-color: rgb(var(--tw-pink-400));
    color: white;
}

.btn-danger:hover,
.btn-danger:focus {
    background-color: rgb(var(--tw-pink-600));
    border-color: rgb(var(--tw-pink-600));
    color: white;
}

.btn-danger:active,
.btn-danger.active,
.btn-danger:focus:active {
    background-color: rgb(var(--tw-pink-600)) !important;
    border-color: rgb(var(--tw-pink-600)) !important;
    color: white !important;
}

.btn-success {
    background-color: rgb(var(--tw-blue-600));
    border-color: rgb(var(--tw-blue-600));
    color: white;
}

.btn-success:hover,
.btn-success:focus {
    background-color: rgb(var(--tw-blue-400));
    border-color: rgb(var(--tw-blue-400));
    color: white;
}

.btn-success:active,
.btn-success.active,
.btn-success:focus:active {
    background-color: rgb(var(--tw-blue-400)) !important;
    border-color: rgb(var(--tw-blue-400)) !important;
    color: white !important;
}

/* ========== FORM STYLES ========== */

.required {
    color: rgb(var(--tw-pink-400));
}

.form-control:focus,
.form-select:focus {
    border-color: rgb(var(--tw-blue-400));
    box-shadow: 0 0 0 0.25rem rgba(31, 183, 209, 0.25);
}

/* Validation error states */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
    box-shadow: none;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.inline-field-error {
    color: #dc3545;
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* ========== LINKS ========== */

a {
    color: rgb(var(--tw-blue-400));
}

a:hover {
    color: rgb(var(--tw-blue-600));
}
