/* Rent24 - Custom Styles */

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a8b;
    --primary-dark: #0f1f33;
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.sidebar-logo-icon {
    width: 42px;
    height: 42px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    font-weight: 700;
}

.sidebar-logo-text {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-logo-text span {
    color: var(--accent);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.sidebar-nav::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-link.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: var(--accent);
}

/* Nav Group with Children */
.nav-group {
    position: relative;
}

.nav-link-wrapper {
    display: flex;
    align-items: stretch;
}

.nav-link-wrapper .nav-link {
    flex: 1;
}

.nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-left: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
    padding: 0 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-toggle:hover {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.08);
}

.nav-toggle i {
    font-size: 0.6rem;
    transition: transform 0.25s ease;
    pointer-events: none;
}

.nav-group.expanded .nav-toggle i {
    transform: rotate(180deg);
}

.nav-children {
    display: none;
    background: rgba(0,0,0,0.2);
    overflow: hidden;
}

.nav-group.expanded .nav-children {
    display: block;
}

.nav-link.nav-child {
    padding: 0.55rem 1.5rem 0.55rem 3rem;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    border-left: 3px solid transparent;
    position: relative;
}

.nav-link.nav-child::before {
    content: '';
    position: absolute;
    left: 1.5rem;
    top: 50%;
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translateY(-50%);
}

.nav-link.nav-child i {
    font-size: 0.8rem;
    width: 16px;
}

.nav-link.nav-child:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.95);
}

.nav-link.nav-child:hover::before {
    background: rgba(255,255,255,0.6);
}

.nav-link.nav-child.active {
    background: rgba(245, 158, 11, 0.18);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 500;
}

.nav-link.nav-child.active::before {
    background: var(--accent);
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: var(--primary-dark);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    background: white;
    height: var(--header-height);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-search {
    position: relative;
    width: 320px;
}

.header-search input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--gray-50);
    transition: all 0.2s ease;
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.header-search i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

/* Header Widget - Location, Date/Time & Weather */
.header-widget {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--gray-600);
}

.header-widget-location {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--primary);
}

.header-widget-location i {
    color: var(--danger);
    font-size: 0.9rem;
}

.header-widget-divider {
    width: 1px;
    height: 24px;
    background: var(--gray-200);
}

.header-widget-datetime {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-widget-datetime i {
    color: var(--info);
}

.header-widget-time {
    font-weight: 600;
    color: var(--gray-800);
    background: var(--gray-100);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
}

.header-widget-weather {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-widget-weather i {
    font-size: 1.1rem;
    color: var(--accent);
}

.header-widget-weather #weatherTemp {
    font-weight: 700;
    color: var(--gray-800);
}

@media (max-width: 768px) {
    .header-widget {
        display: none;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    text-decoration: none;
}

.header-btn:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.header-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 2rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
}

.page-subtitle {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.card-body {
    padding: 1.5rem;
}

/* Document sections for vertical layout */
.document-section {
    padding: 1.25rem 0;
    border-top: none;
}

.document-section:first-child {
    padding-top: 0;
}

.document-section-title {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-200);
    position: relative;
}

.document-section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--primary);
}

.document-section-title i {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Side by side document fields */
.docs-row {
    display: flex;
    gap: 1rem;
}

.docs-row > .form-group {
    flex: 1;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* Stat Cards */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.amber {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-icon.red {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}

.stat-label {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.stat-change {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Tables */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

.table-container::-webkit-scrollbar {
    height: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: transparent;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    color: white;
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline-success {
    background: transparent;
    color: var(--success);
    border: 2px solid var(--success);
}

.btn-outline-success:hover {
    background: var(--success);
    color: white;
}

.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border: 2px solid var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.badge-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-control:disabled {
    background: var(--gray-100);
    color: var(--gray-500);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

/* Grid di card a 2 colonne */
.cards-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.cards-grid-2col > .card {
    margin-bottom: 0;
}

.cards-grid-2col > .card-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cards-grid-2col > .card-column > .card {
    margin-bottom: 0;
}

@media (max-width: 992px) {
    .cards-grid-2col {
        grid-template-columns: 1fr;
    }
}

/* Form row 2 colonne dentro le card */
.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 576px) {
    .form-row-2col {
        grid-template-columns: 1fr;
    }
}

/* Form row 3 colonne */
.form-row-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    align-items: start;
    margin-bottom: 0.5rem;
}

.form-row-3col > .form-group {
    margin-bottom: 0.75rem;
}

@media (max-width: 992px) {
    .form-row-3col {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .form-row-3col {
        grid-template-columns: 1fr;
    }
}

/* Toggle Button Group */
.btn-group-toggle {
    display: flex;
    gap: 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--gray-300);
}

.btn-toggle {
    flex: 1;
    padding: 0.5rem 1rem;
    text-align: center;
    cursor: pointer;
    background: white;
    color: var(--gray-600);
    font-weight: 500;
    transition: all 0.2s ease;
    border-right: 1px solid var(--gray-300);
    position: relative;
}

.btn-toggle:last-child {
    border-right: none;
}

.btn-toggle:hover {
    background: var(--gray-100);
}

.btn-toggle.active {
    background: var(--primary);
    color: white;
}

.btn-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

/* Tank Level Slider */
.tank-level-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tank-slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--danger) 0%, var(--warning) 25%, var(--success) 75%, var(--success) 100%);
    border-radius: 4px;
    outline: none;
}

.tank-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.tank-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.tank-display {
    min-width: 50px;
    text-align: right;
    font-weight: 600;
    color: var(--primary);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

/* iOS Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 28px;
    background: var(--gray-300);
    border-radius: 28px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--gray-700);
    user-select: none;
}

/* Pricing Section Styles */
.pricing-section {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.pricing-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pricing-section-title i {
    font-size: 0.8rem;
}

.pricing-row {
    display: flex;
    gap: 0.75rem;
}

.pricing-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.pricing-row .form-group:last-child {
    flex: 0.6;
}

.pricing-input-group {
    position: relative;
}

.pricing-input-group .form-control {
    padding-right: 3rem;
}

/* Input Group */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    flex: 1;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-600);
    background-color: var(--gray-100);
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.input-group-text-right {
    border-right: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.input-group .input-group-text-right + .form-control,
.input-group .form-control:first-child {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.input-group .form-control:not(:last-child):not(:first-child) {
    border-radius: 0;
}

.input-group:has(.input-group-text-right) .form-control {
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Document Buttons */
.doc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--gray-100);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.doc-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.doc-btn i {
    color: var(--gray-500);
}

.doc-btn:hover i {
    color: white;
}

.doc-btn-missing {
    background: var(--gray-50);
    border-color: var(--gray-200);
    color: var(--gray-400);
    cursor: default;
}

.doc-btn-missing:hover {
    background: var(--gray-50);
    color: var(--gray-400);
    border-color: var(--gray-200);
}

.doc-btn-missing i {
    color: var(--danger);
}

.doc-btn-missing:hover i {
    color: var(--danger);
}

.pricing-input-suffix {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--gray-400);
    pointer-events: none;
}

/* Phone Input with Swiss Flag */
.phone-input-wrapper {
    display: flex;
    align-items: stretch;
    width: 100%;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.phone-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.phone-prefix {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-right: 1px solid var(--gray-300);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9rem;
    white-space: nowrap;
}

.phone-prefix .swiss-flag {
    width: 20px;
    height: 14px;
    background: #ff0000;
    border-radius: 2px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.phone-prefix .swiss-flag::before,
.phone-prefix .swiss-flag::after {
    content: '';
    position: absolute;
    background: white;
}

.phone-prefix .swiss-flag::before {
    width: 10px;
    height: 4px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.phone-prefix .swiss-flag::after {
    width: 4px;
    height: 10px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.phone-input-wrapper .form-control {
    flex: 1;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.phone-input-wrapper .form-control:focus {
    outline: none;
}

/* Extra Items (Zusatzkosten) */
.extra-item {
    background: white;
}

.extra-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: background 0.2s;
}

.extra-item-header:hover {
    background: var(--gray-50);
}

.extra-item-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.extra-item-title i {
    width: 20px;
    text-align: center;
}

.extra-item-amount {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 400;
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    background: var(--gray-100);
    border-radius: 4px;
}

.extra-item-amount.has-value {
    background: var(--success);
    color: white;
}

.extra-item-arrow {
    color: var(--gray-400);
    transition: transform 0.3s;
    font-size: 0.8rem;
}

.extra-item-arrow.expanded {
    transform: rotate(90deg);
}

.extra-item-body {
    padding: 0 1.25rem 1.25rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

.extra-item-body .form-group:first-child {
    padding-top: 1rem;
}

/* File input styling */
input[type="file"].form-control {
    padding: 0.5rem;
    font-size: 0.85rem;
}

input[type="file"].form-control::file-selector-button {
    padding: 0.4rem 0.8rem;
    margin-right: 0.75rem;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

input[type="file"].form-control::file-selector-button:hover {
    background: var(--primary-light);
}

/* Attachment Items */
.attachment-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.attachment-item a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.attachment-item a:hover {
    text-decoration: underline;
}

.attachment-item i {
    margin-right: 0.5rem;
    color: var(--gray-400);
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert > i,
.alert > .fas,
.alert > .far,
.alert > .fab {
    flex-shrink: 0;
    margin-top: 2px;
    line-height: 1.6;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #065f46;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #991b1b;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #92400e;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #1e40af;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: white;
    color: var(--gray-600);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.pagination-btn:hover:not(.active):not(:disabled) {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    color: var(--gray-400);
    padding: 0 0.25rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: var(--gray-400);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* Vehicle Thumbnail */
.vehicle-thumbnail {
    width: 60px;
    height: 45px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    position: relative;
}

.vehicle-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vehicle-thumbnail-empty {
    color: var(--gray-400);
    font-size: 1.25rem;
}

.vehicle-thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.vehicle-thumbnail:hover .vehicle-thumbnail-overlay {
    opacity: 1;
}

/* Table alignment improvements */
.table td {
    vertical-align: middle;
}

.table td strong {
    font-weight: 600;
}

.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.clickable-row:hover {
    background-color: var(--gray-50);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-backdrop.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    background: var(--primary);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
    margin-bottom: 1rem;
}

.login-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
}

.login-logo h1 span {
    color: var(--accent);
}

.login-logo p {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    min-width: 180px;
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--gray-100);
}

.dropdown-item i {
    width: 18px;
    text-align: center;
    color: var(--gray-400);
}

.dropdown-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0.5rem 0;
}

/* Selector Cards (for customer/vehicle selection) */
.selector-card {
    background: white;
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.selector-card:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.selector-card.selected {
    border: 2px solid var(--primary);
    background: rgba(30, 58, 95, 0.03);
}

.selector-card-icon {
    width: 40px;
    height: 40px;
    background: var(--gray-100);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.selector-card.selected .selector-card-icon {
    background: var(--primary);
    color: white;
}

.selector-card-title {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.95rem;
}

.selector-card-subtitle {
    font-size: 0.8rem;
    color: var(--gray-500);
    line-height: 1.4;
}

/* Search List (for modal search results) */
.search-list {
    max-height: 400px;
    overflow-y: auto;
}

.search-list-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.15s ease;
}

.search-list-item:hover {
    background: var(--gray-50);
}

.search-list-item:last-child {
    border-bottom: none;
}

.search-list-item-info {
    flex: 1;
    min-width: 0;
}

.search-list-item-title {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.search-list-item-subtitle {
    font-size: 0.8rem;
    color: var(--gray-500);
    line-height: 1.5;
}

.search-list-item-subtitle i {
    color: var(--gray-400);
}

/* Responsive */

/* Tablet & Mobile - Sidebar overlay */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Sidebar overlay backdrop */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex !important;
    }
    
    /* Dashboard grid - 2 colonne su tablet grande */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Financial cards - 2 colonne su tablet */
    .financial-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    .financial-cards .financial-card:last-child {
        grid-column: span 2;
    }
}

/* Tablet portrait */
@media (max-width: 900px) {
    .page-content {
        padding: 1.25rem;
    }
    
    /* Stat cards - 2 colonne su tablet */
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Financial cards all single column */
    .financial-cards {
        grid-template-columns: 1fr !important;
    }
    
    .financial-cards .financial-card:last-child {
        grid-column: span 1;
    }
    
    .financial-card {
        padding: 1rem;
    }
    
    .financial-card-value {
        font-size: 1.5rem;
    }
    
    /* Card headers - stack on smaller screens */
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .card-header .filter-badge {
        align-self: flex-start;
    }
    
    /* Table responsive */
    .table-container {
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
    
    /* Page header */
    .page-header {
        gap: 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    /* Main header */
    .main-header {
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {
    /* Prevent horizontal overflow on mobile */
    body {
        overflow-x: hidden;
    }
    
    .page-content {
        padding: 1rem;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .stat-cards {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .page-header .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Override for contract actions - NOT full width */
    .page-header .contract-actions .btn {
        width: auto !important;
    }

    .header-search {
        width: 200px;
    }
    
    /* Cards max width */
    .card {
        max-width: 100%;
        overflow-x: auto;
    }
    
    /* Header adjustments */
    .main-header {
        height: 56px;
        padding: 0 0.75rem;
    }
    
    .header-btn {
        width: 36px;
        height: 36px;
    }
    
    .mobile-menu-btn {
        width: 36px;
        height: 36px;
    }
    
    /* Card body padding */
    .card-body {
        padding: 1rem;
    }
    
    /* Table improvements for mobile */
    .data-table th,
    .data-table td {
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Badge sizing */
    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
    
    /* Pagination */
    .pagination-footer {
        padding: 0.5rem 0.75rem;
    }
    
    .pagination-mini a, 
    .pagination-mini span {
        width: 32px;
        height: 32px;
    }
    
    /* Chart bar container */
    .chart-bar-container {
        height: 60px;
    }
    
    .chart-bar-value {
        font-size: 0.55rem;
    }
    
    .chart-bar-label {
        font-size: 0.55rem;
    }
}

/* Touch improvements for mobile/tablet */
@media (max-width: 1024px) {
    /* Prevent text selection on touch elements */
    .btn, .nav-link, .clickable-row, .stat-card, .financial-card-clickable {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        touch-action: manipulation;
    }
    
    /* Larger touch targets */
    .clickable-row td {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    /* Prevent zoom on input focus (iOS) */
    input, select, textarea {
        font-size: 16px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .page-content {
        padding: 0.75rem;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .page-subtitle {
        font-size: 0.8rem;
    }
    
    .stat-card {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
        border-radius: 10px;
    }
    
    .stat-value {
        font-size: 1.35rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    /* Financial card adjustments */
    .financial-card {
        padding: 0.875rem;
    }
    
    .financial-card-value {
        font-size: 1.35rem;
    }
    
    .financial-card-title {
        font-size: 0.7rem;
    }
    
    .financial-card-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    /* Card title */
    .card-title {
        font-size: 0.9rem;
    }
    
    .card-title i {
        font-size: 0.85rem;
    }
    
    /* Filter badge */
    .filter-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

/* Mobile visibility utilities */
.hide-on-mobile { display: inline; }
.show-on-mobile { display: none; }

/* Mobile invoices card view - hidden by default */
.mobile-invoices-view {
    display: none;
}
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Action buttons in table */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* Vehicle/Contract Status Colors */
.status-available { color: var(--success); }
.status-rented { color: var(--warning); }
.status-maintenance { color: var(--danger); }
.status-reserved { color: var(--info); }

/* Clickable row */
.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: var(--gray-50);
}

/* Print styles */
@media print {
    .sidebar, .main-header, .btn, .action-buttons {
        display: none !important;
    }
    .main-content {
        margin-left: 0;
    }
}

/* ===========================================
   CONTRACT FORM RESPONSIVE STYLES
   =========================================== */

/* Main form layout - 2 columns (form + sidebar) */
.contract-form-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* Selector cards container (customer/vehicle) */
.selector-cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Duration buttons grid */
.duration-buttons-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

/* Handover toggle grid (3 columns) */
.handover-toggle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Two column card row (photos + notes) */
.two-card-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Pricing sidebar sticky */
.pricing-sidebar {
    position: sticky;
    top: 80px;
}

/* Modal responsive */
.modal-lg {
    max-width: 800px;
    width: 95%;
}

/* ============ TABLET (max 1024px) ============ */
@media (max-width: 1024px) {
    /* Stack main layout - sidebar goes to top on tablet */
    .contract-form-layout {
        grid-template-columns: 1fr;
    }
    
    /* Pricing sidebar - not sticky on tablet, shows at bottom */
    .contract-form-layout > div:last-child {
        order: 2;
    }
    
    .contract-form-layout > div:first-child {
        order: 1;
    }
    
    .pricing-sidebar {
        position: relative;
        top: 0;
    }
    
    /* Duration buttons - 3 columns on tablet */
    .duration-buttons-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Modal full width on tablet */
    .modal-lg {
        max-width: 95%;
        margin: 1rem;
    }
    
    .modal {
        max-height: 90vh;
        margin: 1rem;
    }
    
    .search-list {
        max-height: 50vh;
    }
}

/* ============ MOBILE (max 768px) ============ */
@media (max-width: 768px) {
    /* Selector cards stack */
    .selector-cards-row {
        grid-template-columns: 1fr;
    }
    
    /* Selector card smaller */
    .selector-card {
        padding: 1rem;
    }
    
    .selector-card-icon {
        font-size: 2rem;
        margin-bottom: 0.25rem;
    }
    
    .selector-card-title {
        font-size: 1rem;
    }
    
    .selector-card-subtitle {
        font-size: 0.8rem;
    }
    
    /* Duration buttons - 2 columns on mobile */
    .duration-buttons-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Handover toggles - stack on mobile */
    .handover-toggle-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    /* Two card row - stack */
    .two-card-row {
        grid-template-columns: 1fr;
    }
    
    /* Pricing sections smaller */
    .pricing-section {
        padding: 0.75rem;
    }
    
    .pricing-section-title {
        font-size: 0.65rem;
    }
    
    .pricing-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .pricing-row .form-group {
        flex: none;
        width: 100%;
    }
    
    /* Modal full screen on mobile */
    .modal-backdrop .modal {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
        margin: 0;
    }
    
    .modal-lg {
        max-width: 100%;
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
    }
    
    .search-list {
        max-height: calc(100vh - 200px);
    }
    
    /* Search list items larger touch targets */
    .search-list-item {
        padding: 1rem;
    }
    
    /* Handover images container */
    .handover-images-container {
        gap: 8px;
    }
    
    .handover-image-item {
        width: 80px;
        height: 60px;
    }
    
    /* Tank slider */
    .tank-level-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .tank-display {
        text-align: center;
        min-width: auto;
    }
    
    /* Toggle buttons */
    .btn-group-toggle {
        flex-direction: row;
    }
    
    .btn-toggle {
        padding: 0.6rem 0.5rem;
        font-size: 0.85rem;
    }
    
    /* Form buttons in card footer */
    .card-footer .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* ============ SMALL MOBILE (max 480px) ============ */
@media (max-width: 480px) {
    /* Duration buttons - still 2 columns but smaller */
    .duration-buttons-grid .btn {
        padding: 0.4rem 0.25rem;
        font-size: 0.75rem;
    }
    
    /* Pricing display */
    .pricing-sidebar .d-flex {
        font-size: 0.85rem;
    }
    
    #total_amount {
        font-size: 1.1rem !important;
    }
    
    /* Selector card even smaller */
    .selector-card {
        padding: 0.75rem;
    }
    
    .selector-card-icon {
        font-size: 1.5rem;
    }
    
    .selector-card-title {
        font-size: 0.9rem;
    }
    
    /* Vehicle thumbnail in modal */
    .vehicle-list-thumb {
        width: 50px;
        height: 38px;
        margin-right: 8px;
    }
}

/* ===========================================
   CONTRACT VIEW RESPONSIVE STYLES
   =========================================== */

/* View page layout - reuses contract-form-layout */

/* Info cards row (customer/vehicle) */
.info-cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Period info grid (3 columns: start, end, duration) */
.period-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.period-grid > div {
    text-align: center;
    padding: 1.25rem;
}

.period-grid > div:not(:last-child) {
    border-right: 1px solid var(--gray-200);
}

/* Vehicle condition grid (6 columns) */
.condition-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}

.condition-grid > div {
    text-align: center;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

/* Card header actions - prevent wrap */
.card-header .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Two column info grid */
.info-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Two column small grid (for pricing details etc) */
.info-grid-2col-sm {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.9rem;
}

/* Three column info grid */
.info-grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* ============ TABLET (max 1024px) ============ */
@media (max-width: 1024px) {
    /* Condition grid - keep 6 columns but smaller on tablet */
    .condition-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 0.5rem;
    }
    
    .condition-grid > div {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .condition-grid .condition-label {
        font-size: 0.65rem !important;
    }
    
    .condition-grid .badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Card header - stay horizontal on tablet */
    .card-header {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }
    
    .card-header .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
        white-space: nowrap;
    }
    
    .card-header .badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.35rem;
    }
    
    .card-header > div {
        flex-shrink: 0;
    }
    
    /* Page header - stay horizontal on tablet */
    .page-header {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }
    
    .page-header > div:first-child {
        flex: 1;
        min-width: 0;
    }
    
    /* Page header actions - icon only buttons on tablet */
    .contract-actions {
        flex-shrink: 0;
        flex-wrap: nowrap !important;
        gap: 0.5rem;
    }
    
    .contract-actions .btn {
        padding: 0 !important;
        font-size: 0 !important;
        line-height: 1 !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        gap: 0 !important;
    }
    
    /* Hide text, show only icons - perfectly centered */
    .contract-actions .btn i {
        margin: 0 !important;
        padding: 0 !important;
        font-size: 1.1rem !important;
        line-height: 1 !important;
        width: auto !important;
        height: auto !important;
        display: inline-block !important;
        text-align: center !important;
    }
    
    .contract-actions .btn i::before {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* ============ MOBILE (max 768px) ============ */
@media (max-width: 768px) {
    /* Info cards stack */
    .info-cards-row {
        grid-template-columns: 1fr;
    }
    
    /* Period grid - stays 3 col but smaller */
    .period-grid > div {
        padding: 0.75rem 0.5rem;
    }
    
    .period-grid > div .period-date {
        font-size: 0.95rem;
    }
    
    .period-grid > div .period-duration {
        font-size: 1.25rem;
    }
    
    /* Condition grid - 3 columns on mobile */
    .condition-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .condition-grid > div {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .condition-grid .condition-label {
        font-size: 0.6rem !important;
    }
    
    /* Two column grids stack */
    .info-grid-2col {
        grid-template-columns: 1fr;
    }
    
    /* Small 2col stays but tighter */
    .info-grid-2col-sm {
        gap: 0.25rem;
        font-size: 0.85rem;
    }
    
    /* Three column grid - 1 column on mobile */
    .info-grid-3col {
        grid-template-columns: 1fr;
    }
    
    /* Card header - stay horizontal, compact on mobile */
    .card-header {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 0.4rem;
        padding: 0.85rem 1rem;
    }
    
    .card-header .card-title {
        flex: 1;
        min-width: 0;
        font-size: 0.9rem;
    }
    
    .card-header .btn-sm {
        padding: 0.2rem 0.4rem !important;
        font-size: 0.65rem !important;
        flex-shrink: 0;
    }
    
    .card-header .badge {
        font-size: 0.6rem;
        flex-shrink: 0;
    }
    
    /* Customer/Vehicle card body - responsive text */
    .info-cards-row .card-body {
        padding: 0.85rem;
    }
    
    .info-cards-row .card-body strong {
        font-size: 0.95rem !important;
    }
    
    .info-cards-row .card-body p,
    .info-cards-row .card-body div {
        font-size: 0.8rem !important;
    }
    
    .info-cards-row .card-body a {
        word-break: break-word;
    }
    
    /* Page header - stay horizontal on mobile */
    .page-header {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 0.75rem;
    }
    
    .page-header > div:first-child {
        flex: 1;
        min-width: 0;
    }
    
    .page-header .page-title {
        font-size: 1.1rem;
    }
    
    .page-header .page-subtitle {
        font-size: 0.75rem;
    }
    
    /* Contract actions - icon only, square buttons */
    .contract-actions {
        flex-shrink: 0;
        flex-wrap: nowrap !important;
        gap: 0.4rem;
    }
    
    .contract-actions .btn {
        padding: 0 !important;
        font-size: 0 !important;
        line-height: 1 !important;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
    }
    
    .contract-actions .btn i {
        margin: 0 !important;
        padding: 0 !important;
        font-size: 1rem !important;
        line-height: 1 !important;
    }
}

/* Return condition grid - green background variant */
.condition-grid-return > div {
    background: rgba(16, 185, 129, 0.1);
}

/* Early return modal stats grid */
.early-return-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

/* Action buttons responsive (view header) */
.contract-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ============ SMALL MOBILE (max 480px) ============ */
@media (max-width: 480px) {
    /* Prevent horizontal scroll */
    .main-content {
        overflow-x: hidden;
    }
    
    /* Period grid - stack on very small screens */
    .period-grid {
        grid-template-columns: 1fr;
    }
    
    .period-grid > div {
        padding: 0.75rem;
        border-right: none !important;
        border-bottom: 1px solid var(--gray-200);
    }
    
    .period-grid > div:last-child {
        border-bottom: none;
    }
    
    /* Condition grid - 3 columns on very small (more compact) */
    .condition-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.35rem;
    }
    
    .condition-grid > div {
        padding: 0.35rem 0.15rem;
        font-size: 0.7rem;
    }
    
    /* Early return stats - 1 column on very small */
    .early-return-stats {
        grid-template-columns: 1fr;
    }
    
    /* Three column info - 1 column on very small */
    .info-grid-3col {
        grid-template-columns: 1fr;
    }
    
    /* Page header - stack vertically on phone */
    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    
    .page-header > div:first-child {
        width: 100%;
    }
    
    .page-header .page-title {
        font-size: 1rem;
        word-break: break-word;
    }
    
    .page-header .page-subtitle {
        font-size: 0.7rem;
    }
    
    /* Contract actions - wrap to fit on phone */
    .contract-actions {
        width: 100%;
        flex-wrap: wrap !important;
        gap: 0.35rem;
        justify-content: flex-start;
    }
    
    .contract-actions .btn {
        padding: 0 !important;
        font-size: 0 !important;
        line-height: 1 !important;
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        min-height: 38px !important;
        max-width: 38px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        flex-shrink: 0;
    }
    
    .contract-actions .btn i {
        margin: 0 !important;
        padding: 0 !important;
        font-size: 0.9rem !important;
        line-height: 1 !important;
    }
    
    /* Card headers - stay horizontal, compact buttons */
    .card-header {
        flex-wrap: nowrap !important;
        gap: 0.35rem;
        padding: 0.75rem 1rem;
    }
    
    .card-header .card-title {
        flex: 1;
        min-width: 0;
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .card-header .btn-sm {
        padding: 0.15rem 0.3rem !important;
        font-size: 0.6rem !important;
        white-space: nowrap;
    }
    
    .card-header .badge {
        font-size: 0.55rem;
        padding: 0.1rem 0.25rem;
    }
    
    /* Customer/Vehicle card body - compact on phone */
    .info-cards-row .card-body {
        padding: 0.85rem !important;
    }
    
    .info-cards-row .card-body strong {
        font-size: 1rem !important;
        display: block;
        line-height: 1.35;
    }
    
    .info-cards-row .card-body .badge {
        font-size: 0.55rem !important;
        padding: 0.15rem 0.35rem !important;
        vertical-align: middle;
    }
    
    .info-cards-row .card-body p,
    .info-cards-row .card-body div {
        font-size: 0.85rem !important;
        line-height: 1.45;
    }
    
    .info-cards-row .card-body a {
        word-break: break-all;
        font-size: 0.85rem;
    }
    
    .info-cards-row .card-body small {
        font-size: 0.8rem !important;
    }
    
    /* Hide/show text on mobile */
    .hide-on-mobile {
        display: none !important;
    }
    
    .show-on-mobile {
        display: inline !important;
    }
    
    /* Invoices - hide table, show cards on mobile */
    .invoices-card .table-container {
        display: none !important;
    }
    
    .mobile-invoices-view {
        display: block !important;
        padding: 0.75rem;
        background: var(--gray-50);
    }
    
    .invoice-card {
        background: white;
        border-radius: 8px;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
        overflow: hidden;
    }
    
    .invoice-card:last-child {
        margin-bottom: 0;
    }
    
    .invoice-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.6rem 0.75rem;
        background: var(--gray-50);
        border-bottom: 1px solid var(--gray-200);
    }
    
    .invoice-card-title {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-weight: 600;
        font-size: 0.85rem;
    }
    
    .invoice-card-title a {
        color: var(--primary);
    }
    
    .invoice-card-title .pdf-link {
        color: var(--danger);
        font-size: 1rem;
    }
    
    .invoice-card-header .badge {
        font-size: 0.65rem;
    }
    
    .invoice-card-body {
        padding: 0.5rem 0.75rem;
    }
    
    .invoice-card-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.35rem 0;
        font-size: 0.8rem;
        border-bottom: 1px solid var(--gray-100);
    }
    
    .invoice-card-row:last-child {
        border-bottom: none;
    }
    
    .invoice-label {
        color: var(--gray-500);
        font-size: 0.75rem;
    }
    
    .invoice-amount {
        font-weight: 600;
    }
    
    .invoice-card .badge-verified,
    .invoice-card .badge-not-verified {
        font-size: 0.7rem;
    }
    
    /* Modal body - prevent overflow */
    .modal-body {
        overflow-x: hidden;
    }
    
    .modal-body .form-control {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Date/time inputs - force fit width */
    input[type="date"],
    input[type="datetime-local"],
    input[type="time"] {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        font-size: 14px !important;
        padding: 0.4rem 0.5rem !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    /* Fix for webkit date picker */
    input[type="date"]::-webkit-calendar-picker-indicator,
    input[type="datetime-local"]::-webkit-calendar-picker-indicator {
        padding: 0;
        margin: 0;
    }
    
    .modal-body .form-label {
        font-size: 0.8rem;
    }
    
    .modal-body .form-group {
        margin-bottom: 0.75rem;
    }
    
    /* Form grids in modal - stack on mobile */
    .modal-body .form-grid-2col {
        grid-template-columns: 1fr !important;
    }
    
    /* Modal layout - more vertical on mobile */
    .modal-responsive {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }
    
    .modal-responsive .modal-header {
        padding: 0.75rem 1rem;
    }
    
    .modal-responsive .modal-header .modal-title {
        font-size: 1rem;
    }
    
    .modal-responsive .modal-body {
        padding: 1rem;
    }
    
    .modal-responsive .modal-footer {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-responsive .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Detail grids inside modals - single column */
    .modal-responsive .detail-grid,
    .modal-body [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    /* Form groups more compact */
    .modal-responsive .form-group {
        margin-bottom: 0.75rem;
    }
    
    .modal-responsive .form-label {
        margin-bottom: 0.25rem;
        font-size: 0.85rem;
    }
    
    .modal-responsive .alert {
        padding: 0.75rem;
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
    
    /* Input groups vertical on very small screens */
    .modal-responsive .input-group {
        flex-wrap: wrap;
    }
}

/* Email Verification Styles */
.email-verification-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.badge-verified {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-verified i {
    font-size: 0.7rem;
}

.badge-not-verified {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-not-verified i {
    font-size: 0.7rem;
}

.btn-verify-email {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-verify-email:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4);
}

.btn-verify-email:active {
    transform: translateY(0);
}

.btn-verify-email i {
    font-size: 0.7rem;
}

/* Email verification icons for list view */
.email-verified-icon {
    color: #10b981;
    font-size: 0.85rem;
}

.email-not-verified-icon {
    color: #f59e0b;
    font-size: 0.85rem;
    opacity: 0.7;
}

