/* ============================================================
   Codesaint Partner Portal - Custom CSS
   Brand Primary: #f37649  |  Light theme only
   ============================================================ */

/* ---- Font Defaults ---- */
h1, h2, h3, h4, h5, h6,
.font-heading {
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background-color: #e2e8f0;
    border-radius: 2px;
}


/* ---- Form Focus States ---- */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #f37649;
    box-shadow: 0 0 0 3px rgba(243, 118, 73, 0.15);
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
    box-shadow: 0 0 0 3px rgba(243, 118, 73, 0.15);
}

/* Django form field wrapper - make rendered widgets match design */
.form-field-wrapper input[type="text"],
.form-field-wrapper input[type="email"],
.form-field-wrapper input[type="password"],
.form-field-wrapper input[type="number"],
.form-field-wrapper input[type="tel"],
.form-field-wrapper input[type="url"],
.form-field-wrapper input[type="date"],
.form-field-wrapper input[type="datetime-local"],
.form-field-wrapper textarea,
.form-field-wrapper select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: #fff;
    color: #1e293b;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-field-wrapper input::placeholder,
.form-field-wrapper textarea::placeholder {
    color: #9ca3af;
}


/* ---- Custom Checkbox & Radio ---- */
input[type="checkbox"] {
    appearance: none;
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

input[type="checkbox"]:checked {
    background-color: #f37649;
    border-color: #f37649;
}

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

input[type="radio"] {
    appearance: none;
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

input[type="radio"]:checked {
    border-color: #f37649;
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #f37649;
}


/* ---- Table Styles ---- */
table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 0.75rem 1rem;
    text-align: left;
    white-space: nowrap;
}

table td {
    padding: 0.875rem 1rem;
    color: #1e293b;
    font-size: 0.875rem;
}

table tbody tr {
    transition: background-color 0.1s ease;
}

table tbody tr:hover {
    background-color: #f8fafc;
}

table tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

table tbody tr:nth-child(even):hover {
    background-color: #f1f5f9;
}


/* ---- File Upload Dropzone ---- */
.dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: #f37649;
    background-color: rgba(243, 118, 73, 0.04);
}

.dropzone.has-file {
    border-color: #10b981;
    background-color: rgba(16, 185, 129, 0.04);
}


/* ---- Progress Stepper ---- */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.stepper-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    left: calc(50% + 20px);
    width: calc(100% - 40px);
    height: 2px;
    background-color: #e5e7eb;
    z-index: 0;
}

.stepper-step.completed:not(:last-child)::after {
    background-color: #f37649;
}

.stepper-circle {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid #e5e7eb;
    background: #fff;
    color: #64748b;
    position: relative;
    z-index: 1;
    transition: all 0.2s ease;
}

.stepper-step.active .stepper-circle {
    border-color: #f37649;
    background-color: #f37649;
    color: #fff;
}

.stepper-step.completed .stepper-circle {
    border-color: #f37649;
    background-color: #f37649;
    color: #fff;
}

.stepper-label {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    text-align: center;
    max-width: 100px;
}

.stepper-step.active .stepper-label {
    color: #f37649;
    font-weight: 600;
}

.stepper-step.completed .stepper-label {
    color: #1e293b;
}


/* ---- Sidebar Mobile Transition ---- */
@media (max-width: 1023px) {
    aside[class*="fixed"] {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}


/* ---- Chart Container ---- */
.chart-container {
    position: relative;
    width: 100%;
}

.chart-container canvas {
    max-width: 100%;
    height: auto !important;
}


/* ---- Animation Keyframes ---- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.3s ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out forwards;
}

.animate-spin-slow {
    animation: spin 1.5s linear infinite;
}


/* ---- Toast Animations ---- */
.toast-enter {
    animation: slideInRight 0.3s ease-out forwards;
}

.toast-leave {
    animation: slideInRight 0.2s ease-in reverse forwards;
}


/* ---- Left Border Accent (for active nav) ---- */
.border-l-3 {
    border-left-width: 3px;
    border-left-style: solid;
}


/* ---- Print Styles ---- */
@media print {
    aside,
    header,
    .no-print,
    #toast-container {
        display: none !important;
    }

    main {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    body {
        background: #fff !important;
        font-size: 12pt;
    }

    .bg-white {
        box-shadow: none !important;
        border: 1px solid #e5e7eb !important;
    }

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

    table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
    }
}


/* ---- Loading Spinner ---- */
.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #e5e7eb;
    border-top-color: #f37649;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 2.5rem;
    height: 2.5rem;
    border-width: 3px;
}


/* ---- Misc Utility ---- */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Prevent FOUC with Alpine.js */
[x-cloak] {
    display: none !important;
}


/* ---- Auth / Login Split Layout ---- */
.brand-bg {
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(255, 255, 255, 0.06), transparent 60%),
        radial-gradient(900px 500px at 110% 120%, rgba(0, 0, 0, 0.25), transparent 60%),
        #505050;
}

.brand-grid {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}
