/* Standardized Component Library - EU Trip Tracker */

/* ===== BUTTON COMPONENTS ===== */

/* Base button styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-family: var(--font-base);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
    min-height: 40px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button variants */
.btn-primary {
    background-color: var(--color-blue-primary);
    color: white;
    border: 1px solid var(--color-blue-primary);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-blue-dark);
    border-color: var(--color-blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 115, 159, 0.2);
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
    border: 1px solid #6b7280;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #4b5563;
    border-color: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(107, 114, 128, 0.2);
}

.btn-danger {
    background-color: var(--color-danger);
    color: white;
    border: 1px solid var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
    background-color: #b91c1c;
    border-color: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(209, 67, 67, 0.2);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-blue-primary);
    border: 1px solid var(--color-blue-primary);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--color-blue-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 115, 159, 0.2);
}

.btn-success {
    background-color: var(--color-success);
    color: white;
    border: 1px solid var(--color-success);
}

.btn-success:hover:not(:disabled) {
    background-color: #15803d;
    border-color: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(22, 163, 74, 0.2);
}

/* Button sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
    min-height: 48px;
}

/* Button with loading state */
.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== FORM COMPONENTS ===== */

/* Form group container */
.form-group {
    margin-bottom: 20px;
}

/* Form labels */
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
}

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

/* Form inputs */
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--font-base);
    background-color: var(--base-bg);
    color: var(--text-primary);
    transition: all 0.2s ease;
    min-height: 40px;
}

/* Ensure native file inputs are clearly interactive and clickable across browsers */
.form-input[type="file"] {
    cursor: pointer;
    position: relative;
    z-index: 2;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-blue-primary);
    box-shadow: 0 0 0 3px rgba(76, 115, 159, 0.1);
}

.form-input:invalid {
    border-color: var(--color-danger);
}

.form-input:disabled {
    background-color: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Form select */
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--font-base);
    background-color: var(--base-bg);
    color: var(--text-primary);
    cursor: pointer;
    min-height: 40px;
}

.form-select:focus {
    outline: none;
    border-color: var(--color-blue-primary);
    box-shadow: 0 0 0 3px rgba(76, 115, 159, 0.1);
}

/* Form hints and errors */
.form-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}

/* ===== STANDARDIZED ERROR MESSAGES ===== */

/* Inline error message (for page-level errors) */
.error-message {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
    color: #991b1b;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.error-message::before {
    content: '⚠';
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.error-message strong {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

/* Success message (for consistency) */
.success-message {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-left: 4px solid #10b981;
    color: #065f46;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.success-message::before {
    content: '✓';
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Warning message */
.warning-message {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    color: #92400e;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.warning-message::before {
    content: '⚠';
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Info message */
.info-message {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.info-message::before {
    content: 'ℹ';
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Form field error (for inline validation) */
.form-error {
    font-size: 12px;
    color: var(--color-danger);
    margin-top: 4px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-error::before {
    content: '⚠';
    font-size: 14px;
}

/* Inline help icons for form labels */
.help-icon-inline {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    cursor: help;
    opacity: 0.6;
    transition: opacity 0.2s;
    margin-left: 4px;
}

.help-icon-inline:hover {
    opacity: 1;
}

.help-icon-inline svg {
    display: block;
    flex-shrink: 0;
}

/* Form validation states */
.form-group.error .form-input,
.form-group.error .form-select {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 3px rgba(209, 67, 67, 0.1);
}

.form-group.success .form-input,
.form-group.success .form-select {
    border-color: var(--color-success);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

/* ===== CARD COMPONENTS ===== */

.card {
    background-color: var(--base-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: visible;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background-color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* ===== MODAL COMPONENTS ===== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal-content {
    background-color: var(--base-bg);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 24px 24px 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

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

.modal-body {
    padding: 0 24px 24px 24px;
}

.modal-footer {
    padding: 16px 24px 24px 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
}

/* ===== BADGE/STATUS COMPONENTS ===== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-neutral {
    background-color: #f3f4f6;
    color: #374151;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.status-safe {
    background-color: #d1fae5;
    color: #065f46;
}

.status-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.status-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* ===== LOADING COMPONENTS ===== */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid var(--color-blue-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner.sm {
    width: 16px;
    height: 16px;
    border-width: 1.5px;
}

.loading-spinner.lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--color-blue-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ===== NOTIFICATION COMPONENTS ===== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--color-success);
}

.notification-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--color-danger);
}

.notification-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.notification-info {
    background-color: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--color-blue-primary);
}

/* ===== TOOLTIP COMPONENTS ===== */

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-trigger {
    cursor: help;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px dotted var(--text-secondary);
}

.tooltip-content {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937;
}

.tooltip:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
}

/* ===== UTILITY CLASSES ===== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: #f59e0b; }

.font-weight-normal { font-weight: 400; }
.font-weight-medium { font-weight: 500; }
.font-weight-semibold { font-weight: 600; }
.font-weight-bold { font-weight: 700; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }

/* ===== ANIMATIONS ===== */

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== COMPLIANCE SUMMARY COMPONENTS ===== */

.compliance-summary {
    position: relative;
    overflow: hidden;
}

.compliance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.compliance-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.compliance-value {
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
}

.compliance-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    font-weight: 600;
}

/* ===== RECENT ACTIONS COMPONENTS ===== */

.recent-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-action-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 8px;
    border-left: 3px solid var(--color-blue-primary);
    transition: all 0.2s ease;
}

.recent-action-item:hover {
    background-color: #f3f4f6;
    transform: translateX(2px);
}

.recent-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--color-blue-primary);
    color: white;
    border-radius: 50%;
    flex-shrink: 0;
}

.recent-action-content {
    flex: 1;
    min-width: 0;
}

.recent-action-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 14px;
}

.recent-action-details {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 4px;
    line-height: 1.4;
}

.recent-action-time {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}

/* ===== BREADCRUMB COMPONENTS ===== */

.breadcrumb-nav {
    padding: 12px 24px;
    background-color: #f9fafb;
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 14px;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item:not(:last-child)::after {
    content: '>';
    margin: 0 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.breadcrumb-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.breadcrumb-link:hover {
    color: var(--color-blue-primary);
    background-color: rgba(76, 115, 159, 0.1);
}

.breadcrumb-item:last-child .breadcrumb-link {
    color: var(--text-primary);
    font-weight: 500;
    cursor: default;
}

.breadcrumb-item:last-child .breadcrumb-link:hover {
    background-color: transparent;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .modal-content {
        margin: 20px;
        max-width: calc(100vw - 40px);
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .breadcrumb-nav {
        padding: 8px 16px;
    }
    
    .breadcrumb {
        font-size: 12px;
    }
    
    .breadcrumb-link {
        padding: 2px 4px;
    }
}
