/* Thermotech Service - Mobile-first operational UI */

/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
    /* Brand — thermotech24.pl */
    --color-primary: #0f4c81;
    --color-primary-hover: #0b3d68;
    --color-primary-light: #e8f3f8;
    --color-accent: #2c7da0;
    
    --color-bg: #f7f9fc;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-border-light: #f3f6f9;
    
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    --color-text-light: #9ca3af;
    
    /* Status colors */
    --color-success: #16a34a;
    --color-success-bg: #f0fdf4;
    --color-warning: #d97706;
    --color-warning-bg: #fef3c7;
    --color-danger: #dc2626;
    --color-danger-bg: #fee2e2;
    --color-info: #0284c7;
    --color-info-bg: #e0f2fe;
    
    /* Priority colors */
    --color-priority-urgent: #dc2626;
    --color-priority-high: #ea580c;
    --color-priority-normal: #6b7280;
    --color-priority-low: #9ca3af;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    
    /* Header and navigation */
    --header-height: 56px;
    --bottom-nav-height: 60px;
    
    /* Touch targets - minimum 44px for accessibility */
    --touch-target-min: 44px;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   App Layout
   ========================================================================== */
.app-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Shell chrome (.app-header, .app-main, .work-nav) lives in base_app.html.twig.
   These rules used to restyle that shell into a fixed 56px bar and clip the menu. */

/* ==========================================================================
   App Header (unused BEM hooks kept for older markup)
   ========================================================================== */

.app-header__brand {
    flex-shrink: 0;
}

.app-header__logo {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    text-decoration: none;
}

.app-header__logo:hover {
    text-decoration: none;
}

.app-header__search {
    flex: 1;
    max-width: 400px;
    display: none;
}

.search-form {
    display: flex;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.search-form__input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    outline: none;
    min-width: 0;
}

.search-form__input::placeholder {
    color: var(--color-text-muted);
}

.search-form__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
}

.search-form__btn:hover {
    color: var(--color-primary);
}

.app-header__nav {
    display: none;
    gap: var(--space-xs);
}

.app-header__link {
    display: inline-flex;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-muted);
    border-radius: var(--radius-md);
    text-decoration: none;
    min-height: var(--touch-target-min);
    transition: background-color 0.15s, color 0.15s;
}

.app-header__link:hover {
    background: var(--color-bg);
    color: var(--color-text);
    text-decoration: none;
}

.app-header__link--active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.app-header__user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-left: auto;
}

.app-header__username {
    display: none;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.app-header__logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    color: var(--color-text-muted);
    border-radius: var(--radius-md);
}

.app-header__logout:hover {
    background: var(--color-bg);
    color: var(--color-danger);
}

/* ==========================================================================
   Bottom Navigation (Mobile)
   ========================================================================== */
.app-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 100;
}

.app-bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    text-decoration: none;
    min-height: var(--touch-target-min);
}

.app-bottom-nav__item:hover {
    text-decoration: none;
}

.app-bottom-nav__item--active {
    color: var(--color-primary);
}

.app-bottom-nav__item svg {
    flex-shrink: 0;
}

/* ==========================================================================
   Dashboard Sections
   ========================================================================== */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.dashboard__header {
    margin-bottom: var(--space-sm);
}

.dashboard__title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin: 0 0 var(--space-xs);
}

.dashboard__subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin: 0;
}

.dashboard-section {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.dashboard-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
}

.dashboard-section__title {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.dashboard-section__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 var(--space-sm);
    background: var(--color-bg);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-full);
}

.dashboard-section__count--urgent {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.dashboard-section__count--warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.dashboard-section__body {
    padding: 0;
}

.dashboard-section--empty {
    padding: var(--space-lg);
    text-align: center;
    color: var(--color-text-muted);
}

/* ==========================================================================
   Order List
   ========================================================================== */
.order-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.order-list__item {
    border-bottom: 1px solid var(--color-border-light);
}

.order-list__item:last-child {
    border-bottom: none;
}

.order-card {
    display: block;
    padding: var(--space-md);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s;
}

.order-card:hover {
    background: var(--color-bg);
    text-decoration: none;
}

.order-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.order-card__unit {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.order-card__priority {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.order-card__priority--urgent {
    background: var(--color-danger-bg);
    color: var(--color-priority-urgent);
}

.order-card__priority--high {
    background: var(--color-warning-bg);
    color: var(--color-priority-high);
}

.order-card__priority--normal {
    background: var(--color-bg);
    color: var(--color-priority-normal);
}

.order-card__priority--low {
    background: var(--color-bg);
    color: var(--color-priority-low);
}

.order-card__customer {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.order-card__description {
    font-size: var(--font-size-sm);
    color: var(--color-text);
    margin-bottom: var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.order-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-md);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.order-card__meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.order-card__number {
    font-family: monospace;
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
}

/* ==========================================================================
   Status Badges
   ========================================================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-sm);
}

.status-badge--new {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.status-badge--planned {
    background: #e0e7ff;
    color: #4f46e5;
}

.status-badge--in_progress {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.status-badge--waiting {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.status-badge--completed {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.status-badge--cancelled {
    background: var(--color-bg);
    color: var(--color-text-muted);
}

/* ==========================================================================
   Inspection List
   ========================================================================== */
.inspection-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.inspection-list__item {
    border-bottom: 1px solid var(--color-border-light);
}

.inspection-list__item:last-child {
    border-bottom: none;
}

.inspection-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s;
}

.inspection-card:hover {
    background: var(--color-bg);
    text-decoration: none;
}

.inspection-card__info {
    flex: 1;
    min-width: 0;
}

.inspection-card__unit {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.inspection-card__customer {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.inspection-card__date {
    flex-shrink: 0;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-sm);
}

.inspection-card__date--overdue {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.inspection-card__date--soon {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.inspection-card__date--upcoming {
    background: var(--color-bg);
    color: var(--color-text-muted);
}

/* ==========================================================================
   Empty States
   ========================================================================== */
.empty-state {
    padding: var(--space-xl);
    text-align: center;
}

.empty-state__icon {
    color: var(--color-text-light);
    margin-bottom: var(--space-sm);
}

.empty-state__text {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin: 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    line-height: 1.5;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    min-height: var(--touch-target-min);
}

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

.btn--primary:hover {
    background: var(--color-primary-hover);
    text-decoration: none;
}

.btn--secondary {
    background: var(--color-surface);
    color: var(--color-primary);
    border: 1px solid #c5d6e6;
}

.btn--secondary:hover {
    background: var(--color-border-light);
    border-color: var(--color-primary);
    color: var(--color-primary-hover);
    text-decoration: none;
}

/* ==========================================================================
   Unit Search Page
   ========================================================================== */
.search-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.search-page__form {
    display: flex;
    gap: var(--space-sm);
}

.search-page__input {
    flex: 1;
    padding: var(--space-md);
    font-size: var(--font-size-base);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    outline: none;
}

.search-page__input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.unit-card {
    display: block;
    padding: var(--space-md);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s;
}

.unit-card:hover {
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.unit-card__reg {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.unit-card__model {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.unit-card__customer {
    font-size: var(--font-size-sm);
    color: var(--color-text);
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */
@media (min-width: 640px) {
    .app-header__search {
        display: block;
    }
    
    .app-header__username {
        display: block;
    }
}

@media (min-width: 768px) {
    .app-header__nav {
        display: flex;
    }
    
    .app-bottom-nav {
        display: none;
    }

    .dashboard:not(.tt-today) {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg);
    }
    
    .dashboard__header {
        grid-column: 1 / -1;
    }
    
    .dashboard-section--full {
        grid-column: 1 / -1;
    }
}

@media (min-width: 1024px) {
    .dashboard:not(.tt-today) {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Icon Helper */
.icon {
    font-style: normal;
}
