/**
 * DTX Shared Components
 * Herbruikbare UI componenten voor alle DTX modules
 */

/* ============================================================================
   Toggle Switch
   ============================================================================ */

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input[type="checkbox"] {
    position: relative;
    width: 44px;
    height: 24px;
    appearance: none;
    background: var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.toggle-switch input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.toggle-switch input[type="checkbox"]:checked {
    background: var(--accent-color);
}

.toggle-switch input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}

.toggle-switch input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-switch:has(input:disabled) {
    cursor: not-allowed;
}

.toggle-switch:has(input:disabled) .toggle-label {
    opacity: 0.5;
}

.toggle-label {
    font-size: 14px;
    color: var(--text-color);
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-color);
    border-color: var(--text-muted);
}

.btn-icon span {
    font-size: 12px;
}

/* ============================================================================
   Form Labels
   ============================================================================ */

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* ============================================================================
   Form Inputs
   ============================================================================ */

.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-select {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s ease;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-control:disabled,
.form-select:disabled {
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* ============================================================================
   Alerts / Messages
   ============================================================================ */

.alert {
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.alert-success {
    background: rgba(25, 135, 84, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid var(--warning-color);
    color: var(--warning-color);
}

/* ============================================================================
   Spinner
   ============================================================================ */

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* ============================================================================
   License Plate (Nederlandse kentekenplaat)
   Gebruik: DTX.licensePlate.render(element, kenteken, options)
   ============================================================================ */

.license-plate {
    display: inline-flex;
    align-items: stretch;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15), inset 0 0 0 1px #000;
}

/* Blauwe NL strook */
.license-plate-strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #003399 0%, #002266 100%);
    padding: 4px 6px;
    min-width: 28px;
}

/* EU sterren cirkel */
.license-plate-stars {
    position: relative;
    width: 16px;
    height: 16px;
    margin-bottom: 2px;
}

.license-plate-stars span {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #FFD700;
    border-radius: 50%;
    left: 50%;
    top: 50%;
    margin: -1px 0 0 -1px;
}

.license-plate-stars span:nth-child(1)  { transform: rotate(0deg) translateY(-6px); }
.license-plate-stars span:nth-child(2)  { transform: rotate(30deg) translateY(-6px); }
.license-plate-stars span:nth-child(3)  { transform: rotate(60deg) translateY(-6px); }
.license-plate-stars span:nth-child(4)  { transform: rotate(90deg) translateY(-6px); }
.license-plate-stars span:nth-child(5)  { transform: rotate(120deg) translateY(-6px); }
.license-plate-stars span:nth-child(6)  { transform: rotate(150deg) translateY(-6px); }
.license-plate-stars span:nth-child(7)  { transform: rotate(180deg) translateY(-6px); }
.license-plate-stars span:nth-child(8)  { transform: rotate(210deg) translateY(-6px); }
.license-plate-stars span:nth-child(9)  { transform: rotate(240deg) translateY(-6px); }
.license-plate-stars span:nth-child(10) { transform: rotate(270deg) translateY(-6px); }
.license-plate-stars span:nth-child(11) { transform: rotate(300deg) translateY(-6px); }
.license-plate-stars span:nth-child(12) { transform: rotate(330deg) translateY(-6px); }

/* NL landcode */
.license-plate-country {
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

/* Gele kentekenplaat waarde (basis styling voor beide varianten) */
.license-plate-value {
    background: #F7B500;
    font-family: monospace;
    font-weight: 700;
    color: #000;
    letter-spacing: 0.025em;
    display: flex;
    align-items: center;
}

/* Display variant: alleen weergave */
.license-plate--display .license-plate-value {
    padding: 4px 10px;
}

/* Input variant: bewerkbaar invoerveld */
.license-plate--input .license-plate-value {
    border: none;
    padding: 12px 16px;
    font-size: 28px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    min-width: 180px;
    outline: none;
}

.license-plate--input .license-plate-value::placeholder {
    color: rgba(0, 0, 0, 0.3);
}

.license-plate--input .license-plate-value:focus {
    background: #FFCC00;
}

/* Input + Motor combinatie */
.license-plate--input.license-plate--motor {
    flex-direction: column;
    width: auto;
}

.license-plate--input.license-plate--motor .license-plate-strip {
    flex-direction: row;
    padding: 4px 16px;
    min-width: auto;
    width: 100%;
    gap: 6px;
}

.license-plate--input.license-plate--motor .license-plate-value {
    min-width: 120px;
    padding: 8px 16px;
    font-size: 24px;
}

/* Editable motorplaat (klikbaar om te bewerken) */
.license-plate-editable {
    cursor: pointer;
    outline: none;
}

.license-plate-editable:hover,
.license-plate-editable:focus {
    filter: brightness(1.05);
}

.license-plate-editable:focus {
    outline: 2px solid var(--accent-color, #0d6efd);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Grootte varianten */
.license-plate--lg {
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), inset 0 0 0 2px #000;
}

.license-plate--lg .license-plate-strip {
    padding: 4px 8px;
    min-width: 36px;
}

.license-plate--lg .license-plate-stars {
    width: 20px;
    height: 20px;
}

.license-plate--lg .license-plate-stars span {
    transform-origin: center;
}

.license-plate--lg .license-plate-stars span:nth-child(1)  { transform: rotate(0deg) translateY(-8px); }
.license-plate--lg .license-plate-stars span:nth-child(2)  { transform: rotate(30deg) translateY(-8px); }
.license-plate--lg .license-plate-stars span:nth-child(3)  { transform: rotate(60deg) translateY(-8px); }
.license-plate--lg .license-plate-stars span:nth-child(4)  { transform: rotate(90deg) translateY(-8px); }
.license-plate--lg .license-plate-stars span:nth-child(5)  { transform: rotate(120deg) translateY(-8px); }
.license-plate--lg .license-plate-stars span:nth-child(6)  { transform: rotate(150deg) translateY(-8px); }
.license-plate--lg .license-plate-stars span:nth-child(7)  { transform: rotate(180deg) translateY(-8px); }
.license-plate--lg .license-plate-stars span:nth-child(8)  { transform: rotate(210deg) translateY(-8px); }
.license-plate--lg .license-plate-stars span:nth-child(9)  { transform: rotate(240deg) translateY(-8px); }
.license-plate--lg .license-plate-stars span:nth-child(10) { transform: rotate(270deg) translateY(-8px); }
.license-plate--lg .license-plate-stars span:nth-child(11) { transform: rotate(300deg) translateY(-8px); }
.license-plate--lg .license-plate-stars span:nth-child(12) { transform: rotate(330deg) translateY(-8px); }

.license-plate--lg .license-plate-country {
    font-size: 14px;
}

.license-plate--lg .license-plate-value {
    font-size: 28px;
    padding: 8px 16px;
}

/* Small variant */
.license-plate--sm .license-plate-strip {
    padding: 2px 4px;
    min-width: 20px;
}

.license-plate--sm .license-plate-stars {
    width: 12px;
    height: 12px;
    margin-bottom: 1px;
}

.license-plate--sm .license-plate-stars span {
    width: 1.5px;
    height: 1.5px;
}

.license-plate--sm .license-plate-stars span:nth-child(1)  { transform: rotate(0deg) translateY(-4px); }
.license-plate--sm .license-plate-stars span:nth-child(2)  { transform: rotate(30deg) translateY(-4px); }
.license-plate--sm .license-plate-stars span:nth-child(3)  { transform: rotate(60deg) translateY(-4px); }
.license-plate--sm .license-plate-stars span:nth-child(4)  { transform: rotate(90deg) translateY(-4px); }
.license-plate--sm .license-plate-stars span:nth-child(5)  { transform: rotate(120deg) translateY(-4px); }
.license-plate--sm .license-plate-stars span:nth-child(6)  { transform: rotate(150deg) translateY(-4px); }
.license-plate--sm .license-plate-stars span:nth-child(7)  { transform: rotate(180deg) translateY(-4px); }
.license-plate--sm .license-plate-stars span:nth-child(8)  { transform: rotate(210deg) translateY(-4px); }
.license-plate--sm .license-plate-stars span:nth-child(9)  { transform: rotate(240deg) translateY(-4px); }
.license-plate--sm .license-plate-stars span:nth-child(10) { transform: rotate(270deg) translateY(-4px); }
.license-plate--sm .license-plate-stars span:nth-child(11) { transform: rotate(300deg) translateY(-4px); }
.license-plate--sm .license-plate-stars span:nth-child(12) { transform: rotate(330deg) translateY(-4px); }

.license-plate--sm .license-plate-country {
    font-size: 8px;
}

.license-plate--sm .license-plate-value {
    font-size: 24px;
    padding: 2px 6px;
}

/* Zonder sterren */
.license-plate--no-stars .license-plate-stars {
    display: none;
}

.license-plate--no-stars .license-plate-strip {
    justify-content: center;
}

/* Motorplaat variant (verticaal formaat) */
.license-plate--motor {
    flex-direction: column;
    border-radius: 4px;
}

.license-plate--motor .license-plate-strip {
    flex-direction: row;
    padding: 3px 8px;
    min-width: auto;
    width: 100%;
    gap: 4px;
}

.license-plate--motor .license-plate-stars {
    margin-bottom: 0;
    width: 14px;
    height: 14px;
}

.license-plate--motor .license-plate-stars span:nth-child(1)  { transform: rotate(0deg) translateY(-5px); }
.license-plate--motor .license-plate-stars span:nth-child(2)  { transform: rotate(30deg) translateY(-5px); }
.license-plate--motor .license-plate-stars span:nth-child(3)  { transform: rotate(60deg) translateY(-5px); }
.license-plate--motor .license-plate-stars span:nth-child(4)  { transform: rotate(90deg) translateY(-5px); }
.license-plate--motor .license-plate-stars span:nth-child(5)  { transform: rotate(120deg) translateY(-5px); }
.license-plate--motor .license-plate-stars span:nth-child(6)  { transform: rotate(150deg) translateY(-5px); }
.license-plate--motor .license-plate-stars span:nth-child(7)  { transform: rotate(180deg) translateY(-5px); }
.license-plate--motor .license-plate-stars span:nth-child(8)  { transform: rotate(210deg) translateY(-5px); }
.license-plate--motor .license-plate-stars span:nth-child(9)  { transform: rotate(240deg) translateY(-5px); }
.license-plate--motor .license-plate-stars span:nth-child(10) { transform: rotate(270deg) translateY(-5px); }
.license-plate--motor .license-plate-stars span:nth-child(11) { transform: rotate(300deg) translateY(-5px); }
.license-plate--motor .license-plate-stars span:nth-child(12) { transform: rotate(330deg) translateY(-5px); }

.license-plate--motor .license-plate-value {
    flex-direction: column;
    padding: 4px 8px;
    line-height: 1.1;
    text-align: center;
}

/* Motorplaat grootte varianten */
.license-plate--motor.license-plate--sm .license-plate-strip {
    padding: 2px 6px;
    gap: 3px;
}

.license-plate--motor.license-plate--sm .license-plate-stars {
    width: 10px;
    height: 10px;
}

.license-plate--motor.license-plate--sm .license-plate-stars span:nth-child(1)  { transform: rotate(0deg) translateY(-3px); }
.license-plate--motor.license-plate--sm .license-plate-stars span:nth-child(2)  { transform: rotate(30deg) translateY(-3px); }
.license-plate--motor.license-plate--sm .license-plate-stars span:nth-child(3)  { transform: rotate(60deg) translateY(-3px); }
.license-plate--motor.license-plate--sm .license-plate-stars span:nth-child(4)  { transform: rotate(90deg) translateY(-3px); }
.license-plate--motor.license-plate--sm .license-plate-stars span:nth-child(5)  { transform: rotate(120deg) translateY(-3px); }
.license-plate--motor.license-plate--sm .license-plate-stars span:nth-child(6)  { transform: rotate(150deg) translateY(-3px); }
.license-plate--motor.license-plate--sm .license-plate-stars span:nth-child(7)  { transform: rotate(180deg) translateY(-3px); }
.license-plate--motor.license-plate--sm .license-plate-stars span:nth-child(8)  { transform: rotate(210deg) translateY(-3px); }
.license-plate--motor.license-plate--sm .license-plate-stars span:nth-child(9)  { transform: rotate(240deg) translateY(-3px); }
.license-plate--motor.license-plate--sm .license-plate-stars span:nth-child(10) { transform: rotate(270deg) translateY(-3px); }
.license-plate--motor.license-plate--sm .license-plate-stars span:nth-child(11) { transform: rotate(300deg) translateY(-3px); }
.license-plate--motor.license-plate--sm .license-plate-stars span:nth-child(12) { transform: rotate(330deg) translateY(-3px); }

.license-plate--motor.license-plate--sm .license-plate-country {
    font-size: 7px;
}

.license-plate--motor.license-plate--sm .license-plate-value {
    padding: 2px 4px;
    font-size: 11px;
}

.license-plate--motor.license-plate--lg .license-plate-strip {
    padding: 4px 12px;
    gap: 6px;
}

.license-plate--motor.license-plate--lg .license-plate-stars {
    width: 18px;
    height: 18px;
}

.license-plate--motor.license-plate--lg .license-plate-stars span:nth-child(1)  { transform: rotate(0deg) translateY(-7px); }
.license-plate--motor.license-plate--lg .license-plate-stars span:nth-child(2)  { transform: rotate(30deg) translateY(-7px); }
.license-plate--motor.license-plate--lg .license-plate-stars span:nth-child(3)  { transform: rotate(60deg) translateY(-7px); }
.license-plate--motor.license-plate--lg .license-plate-stars span:nth-child(4)  { transform: rotate(90deg) translateY(-7px); }
.license-plate--motor.license-plate--lg .license-plate-stars span:nth-child(5)  { transform: rotate(120deg) translateY(-7px); }
.license-plate--motor.license-plate--lg .license-plate-stars span:nth-child(6)  { transform: rotate(150deg) translateY(-7px); }
.license-plate--motor.license-plate--lg .license-plate-stars span:nth-child(7)  { transform: rotate(180deg) translateY(-7px); }
.license-plate--motor.license-plate--lg .license-plate-stars span:nth-child(8)  { transform: rotate(210deg) translateY(-7px); }
.license-plate--motor.license-plate--lg .license-plate-stars span:nth-child(9)  { transform: rotate(240deg) translateY(-7px); }
.license-plate--motor.license-plate--lg .license-plate-stars span:nth-child(10) { transform: rotate(270deg) translateY(-7px); }
.license-plate--motor.license-plate--lg .license-plate-stars span:nth-child(11) { transform: rotate(300deg) translateY(-7px); }
.license-plate--motor.license-plate--lg .license-plate-stars span:nth-child(12) { transform: rotate(330deg) translateY(-7px); }

.license-plate--motor.license-plate--lg .license-plate-country {
    font-size: 12px;
}

.license-plate--motor.license-plate--lg .license-plate-value {
    padding: 6px 12px;
    font-size: 24px;
}
