/* ==========================================
   TaxiPlanner – UI Komponenten
   ========================================== */

/* ==========================================
   BUTTONS
   ========================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1;
    text-decoration: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-strong);
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    padding: var(--space-2) var(--space-3);
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn .loading-spinner {
    width: 16px;
    height: 16px;
}

/* ==========================================
   FORM ELEMENTS
   ========================================== */

.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--danger);
    margin-top: var(--space-1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   MODALS
   ========================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal-overlay);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(20px) scale(0.95);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
}

/* ==========================================
   BADGES / TAGS
   ========================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 8px;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-category {
    padding: 3px 10px;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */

.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 380px;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    animation: slideInRight 0.3s ease both;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.toast-success::before { background: var(--success); }
.toast-error::before { background: var(--danger); }
.toast-warning::before { background: var(--warning); }
.toast-info::before { background: var(--info); }

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    margin-bottom: 2px;
}

.toast-message {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    font-size: 1rem;
    line-height: 1;
}

.toast.hiding {
    animation: fadeOut 0.3s ease both;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* ==========================================
   FILTER BAR
   ========================================== */

.filter-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.filter-group label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: var(--font-medium);
    white-space: nowrap;
}

.filter-input {
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-family);
    font-size: var(--text-xs);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-fast);
}

.filter-input:focus {
    outline: none;
    border-color: var(--accent);
}

.period-tabs {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 3px;
    border: 1px solid var(--border-subtle);
}

.period-tab {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-family: var(--font-family);
    white-space: nowrap;
}

.period-tab:hover {
    color: var(--text-primary);
}

.period-tab.active {
    background: var(--accent);
    color: var(--text-inverse);
}

/* ==========================================
   CATEGORY DOT
   ========================================== */

.category-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: var(--space-2);
    flex-shrink: 0;
}

/* ==========================================
   DRIVER CARDS (Mobile)
   ========================================== */

.driver-trip-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.driver-trip-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: all var(--transition-fast);
}

.driver-trip-card:hover {
    border-color: var(--border-strong);
}

.driver-trip-time {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--accent);
}

.driver-trip-category {
    margin-top: var(--space-1);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.driver-trip-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
}

.driver-trip-field {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: 2px;
}

.driver-trip-value {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.driver-trip-notes {
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-style: italic;
}

/* ==========================================
   DONUT CHART (CSS-based)
   ========================================== */

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.donut-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--text-sm);
}

.donut-legend-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
}

.donut-legend-value {
    font-weight: var(--font-semibold);
}
