/* =================================================================
   KISS Component Library — Fuller Companies
   
   Keep It Simple, Stupid.
   
   All component classes for buttons, badges, cards, and form
   elements. Designed for oversized, touch-friendly interfaces.
   ================================================================= */


/* -----------------------------------------------------------------
   BUTTONS
   
   Sizes:   btn-sm, (default), btn-lg, btn-kiss
   Colors:  btn-primary, btn-secondary, btn-danger, btn-success,
            btn-warning, btn-orange, btn-blue
   Variants: btn-outline-{color}
   Width:   btn-full (100% width)
   ----------------------------------------------------------------- */

/* Base button reset — applied to .btn AND all color variants so
   templates can use e.g. class="btn-primary" without needing "btn" */
.btn,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success,
.btn-warning,
.btn-orange,
.btn-blue,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    border-radius: 0.75rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    transition: all 150ms ease;
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}

.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.btn-success:focus-visible,
.btn-warning:focus-visible,
.btn-orange:focus-visible,
.btn-blue:focus-visible,
.btn-outline-primary:focus-visible,
.btn-outline-secondary:focus-visible,
.btn-outline-danger:focus-visible {
    outline: 2px solid #015E99;
    outline-offset: 2px;
}

.btn:disabled, .btn.disabled,
.btn-primary:disabled, .btn-primary.disabled,
.btn-secondary:disabled, .btn-secondary.disabled,
.btn-danger:disabled, .btn-danger.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---- Sizes ---- */

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
    gap: 0.375rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    line-height: 1.5rem;
    border-radius: 0.75rem;
}

/* KISS size: oversized for touch screens / field use */
.btn-kiss {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    line-height: 1.75rem;
    border-radius: 1rem;
    min-height: 3.5rem;       /* 56px — exceeds 44px min touch target */
    min-width: 8rem;
}

/* Full width (stacks nicely on mobile) */
.btn-full {
    width: 100%;
}

/* ---- Colors ---- */

/* Primary (Fuller Red) */
.btn-primary {
    background-color: #ED1C24;
    color: #ffffff;
    border-color: #ED1C24;
}
.btn-primary:hover {
    background-color: #E02B20;
    border-color: #E02B20;
}

/* Secondary (Gray) */
.btn-secondary {
    background-color: #f3f4f6;
    color: #414042;
    border-color: #e5e7eb;
}
.btn-secondary:hover {
    background-color: #e5e7eb;
    border-color: #d1d5db;
}

/* Danger (Red — for destructive actions) */
.btn-danger {
    background-color: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}
.btn-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

/* Success (Green) */
.btn-success {
    background-color: #22c55e;
    color: #ffffff;
    border-color: #22c55e;
}
.btn-success:hover {
    background-color: #16a34a;
    border-color: #16a34a;
}

/* Warning (Yellow) */
.btn-warning {
    background-color: #eab308;
    color: #ffffff;
    border-color: #eab308;
}
.btn-warning:hover {
    background-color: #ca8a04;
    border-color: #ca8a04;
}

/* Orange (Flag / Attention) */
.btn-orange {
    background-color: #f97316;
    color: #ffffff;
    border-color: #f97316;
}
.btn-orange:hover {
    background-color: #ea580c;
    border-color: #ea580c;
}

/* Blue (Info / Fuller Blue) */
.btn-blue {
    background-color: #015E99;
    color: #ffffff;
    border-color: #015E99;
}
.btn-blue:hover {
    background-color: #014d80;
    border-color: #014d80;
}

/* ---- Outline variants ---- */

.btn-outline-primary {
    background-color: transparent;
    color: #ED1C24;
    border-color: #ED1C24;
}
.btn-outline-primary:hover {
    background-color: #ED1C24;
    color: #ffffff;
}

.btn-outline-secondary {
    background-color: transparent;
    color: #414042;
    border-color: #d1d5db;
}
.btn-outline-secondary:hover {
    background-color: #f3f4f6;
}

.btn-outline-danger {
    background-color: transparent;
    color: #dc2626;
    border-color: #dc2626;
}
.btn-outline-danger:hover {
    background-color: #dc2626;
    color: #ffffff;
}


/* -----------------------------------------------------------------
   STATUS BADGES
   
   Usage: <span class="badge badge-{status}">Label</span>
   Sizes: (default), badge-lg
   ----------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    white-space: nowrap;
}

.badge-lg {
    padding: 0.25rem 0.875rem;
    font-size: 0.875rem;
}

/* Status colors */
.badge-red, .badge-danger, .badge-critical, .badge-down {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-orange, .badge-flagged {
    background-color: #fff7ed;
    color: #9a3412;
}

.badge-yellow, .badge-warning, .badge-needs-work {
    background-color: #fef9c3;
    color: #854d0e;
}

.badge-green, .badge-success, .badge-good, .badge-active {
    background-color: #dcfce7;
    color: #166534;
}

.badge-blue, .badge-info, .badge-in-use {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-gray, .badge-inactive, .badge-retired {
    background-color: #f3f4f6;
    color: #4b5563;
}

/* Priority badges */
.badge-priority-1 { background-color: #fee2e2; color: #991b1b; }  /* Critical */
.badge-priority-2 { background-color: #fff7ed; color: #9a3412; }  /* High */
.badge-priority-3 { background-color: #fef9c3; color: #854d0e; }  /* Medium */
.badge-priority-4 { background-color: #dbeafe; color: #1e40af; }  /* Low */


/* -----------------------------------------------------------------
   CARDS
   ----------------------------------------------------------------- */

.card {
    background-color: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1rem;
}

@media (min-width: 640px) {
    .card-header { padding: 1rem 1.25rem; }
    .card-body   { padding: 1.25rem; }
}

@media (min-width: 1024px) {
    .card-header { padding: 1rem 1.5rem; }
    .card-body   { padding: 1.5rem; }
}

/* Stat card (number + label) */
.stat-card {
    background-color: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666666;
    margin-bottom: 0.5rem;
}


/* -----------------------------------------------------------------
   FORM INPUTS (KISS sizing)
   ----------------------------------------------------------------- */

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
    line-height: 1.5;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    background-color: #ffffff;
    transition: border-color 150ms ease, box-shadow 150ms ease;
    font-family: 'Open Sans', sans-serif;
}

.form-input:focus {
    outline: none;
    border-color: #015E99;
    box-shadow: 0 0 0 3px rgba(1, 94, 153, 0.15);
}

.form-input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
}

/* KISS size input (larger for touch) */
.form-input-kiss {
    padding: 0.875rem 1rem;
    font-size: 1.125rem;
    min-height: 3.25rem;
}

/* Collapsible card sections (details/summary) */
summary.card-header::-webkit-details-marker,
summary.card-header::marker {
    display: none;
    content: '';
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #414042;
    margin-bottom: 0.375rem;
}

.form-help {
    font-size: 0.75rem;
    color: #666666;
    margin-top: 0.25rem;
}

.form-error {
    font-size: 0.75rem;
    color: #dc2626;
    margin-top: 0.25rem;
}


/* -----------------------------------------------------------------
   TOAST / NOTIFICATION
   ----------------------------------------------------------------- */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 24rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    font-size: 0.875rem;
    font-weight: 500;
    animation: toast-in 300ms ease forwards;
}

.toast-success { background-color: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.toast-error   { background-color: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.toast-warning { background-color: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.toast-info    { background-color: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.toast-dismiss {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 150ms;
}
.toast-dismiss:hover { opacity: 1; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(1rem); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(1rem); }
}


/* -----------------------------------------------------------------
   CONFIRMATION MODAL
   ----------------------------------------------------------------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-panel {
    background-color: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 28rem;
    width: 100%;
    overflow: hidden;
}

.modal-header {
    padding: 1.5rem 1.5rem 0;
    text-align: center;
}

.modal-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.modal-icon-danger  { background-color: #fee2e2; color: #dc2626; }
.modal-icon-warning { background-color: #fff7ed; color: #f97316; }
.modal-icon-info    { background-color: #dbeafe; color: #015E99; }
.modal-icon-success { background-color: #dcfce7; color: #22c55e; }

.modal-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.125rem;
    font-weight: 700;
    color: #414042;
    margin-bottom: 0.5rem;
}

.modal-body {
    padding: 0.75rem 1.5rem;
    text-align: center;
    color: #666666;
    font-size: 0.9375rem;
}

.modal-actions {
    padding: 1.25rem 1.5rem;
    display: flex;
    gap: 0.75rem;
}

.modal-actions .btn {
    flex: 1;
}


/* -----------------------------------------------------------------
   EMPTY STATE
   ----------------------------------------------------------------- */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    color: #d1d5db;
}

.empty-state-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.125rem;
    font-weight: 700;
    color: #414042;
    margin-bottom: 0.25rem;
}

.empty-state-message {
    color: #666666;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}


/* -----------------------------------------------------------------
   TV DISPLAY UTILITIES
   (Used by shop dashboard and operations dashboard)
   ----------------------------------------------------------------- */

.tv-text-lg  { font-size: 1.25rem; }
.tv-text-xl  { font-size: 1.5rem; }
.tv-text-2xl { font-size: 2rem; }
.tv-text-3xl { font-size: 2.5rem; }
.tv-text-4xl { font-size: 3rem; }

@keyframes pulse-slow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}

.pulse-critical {
    animation: pulse-slow 2s ease-in-out infinite;
}


/* -----------------------------------------------------------------
   RESPONSIVE HELPERS
   ----------------------------------------------------------------- */

/* Form container that scales with the viewport:
   Phone:   full width
   Tablet:  max 42rem (672px)
   Desktop: max 56rem (896px)
   Wide:    max 64rem (1024px)                                      */
.form-container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}
@media (min-width: 640px)  { .form-container { max-width: 42rem; } }
@media (min-width: 1024px) { .form-container { max-width: 56rem; } }
@media (min-width: 1280px) { .form-container { max-width: 64rem; } }

/* On mobile, make action button groups stack vertically */
@media (max-width: 640px) {
    .btn-group-mobile-stack {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    .btn-group-mobile-stack .btn {
        width: 100%;
    }
}
