/* NomadCare Trips — Orange Theme */
:root {
    --orange-400: #fb923c;
    --orange-500: #f97316;
    --orange-600: #ea580c;
    --bg-dark: #0f0f11;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(249, 115, 22, 0.5);
    --text-primary: #f5f5f5;
    --text-secondary: #a3a3a3;
    --text-muted: #737373;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* Auth pages */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.auth-logo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--orange-400), var(--orange-600));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}

.auth-form {
    text-align: left;
}

.auth-footer {
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-link {
    color: var(--orange-400);
    text-decoration: none;
    font-weight: 500;
}

.auth-link:hover {
    text-decoration: underline;
}

/* Forms */
.form-group {
    margin-bottom: 14px;
}

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

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

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

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

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

.form-row {
    display: flex;
    gap: 12px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-vertical {
    display: flex;
    flex-direction: column;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a3a3a3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--orange-400), var(--orange-600));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-primary:hover {
    opacity: 0.9;
}

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

.btn-center {
    display: block;
    width: 100%;
    text-align: center;
    justify-content: center;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-icon.btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.btn-icon-round {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-icon-round:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--orange-400);
    color: var(--orange-400);
}

/* Page layout */
.page-wrapper {
    min-height: 100vh;
    padding: 24px;
}

.page-container {
    max-width: 900px;
    margin: 0 auto;
}

.page-narrow {
    max-width: 600px;
}

.page-header {
    margin-bottom: 24px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 12px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text-primary);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

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

.card-title {
    font-size: 16px;
    font-weight: 600;
}

/* Trip cards grid */
.trips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.trip-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.trip-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(249, 115, 22, 0.3);
    transform: translateY(-2px);
}

.trip-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.trip-country-code {
    font-size: 20px;
    font-weight: 700;
}

.trip-city {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.trip-status {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.trip-status-DRAFT {
    background: rgba(163, 163, 163, 0.15);
    color: #a3a3a3;
}

.trip-status-ACTIVE {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.trip-status-COMPLETED {
    background: rgba(249, 115, 22, 0.15);
    color: var(--orange-400);
}

.trip-status-CANCELLED {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.trip-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.trip-dates, .trip-flight {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.date-sep {
    color: var(--text-muted);
}

.trip-trs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.trs-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.trs-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--orange-400), var(--orange-600));
    border-radius: 2px;
    transition: width 0.3s;
}

.trs-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Trip info grid */
.trip-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 14px;
    font-weight: 500;
}

/* Legs */
.legs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leg-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.leg-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
}

.drag-handle:active {
    cursor: grabbing;
}

.leg-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    background: rgba(249, 115, 22, 0.12);
    color: var(--orange-400);
}

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

.leg-route {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: 14px;
}

.leg-route svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.leg-point {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leg-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.leg-tag {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 7px;
    border-radius: 4px;
}

.leg-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.empty-legs {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Sortable ghost */
.sortable-ghost {
    opacity: 0.4;
    background: rgba(249, 115, 22, 0.1) !important;
    border-color: rgba(249, 115, 22, 0.3) !important;
}

/* Popup / Modal */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.popup {
    background: #1a1a1e;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.popup-wide {
    max-width: 580px;
}

.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.popup-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.popup-body {
    padding: 20px;
}

.popup-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
}

.popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

/* Activities grid */
.activities-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s, border-color 0.2s;
}

.activity-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

.activity-item input[type="checkbox"] {
    accent-color: var(--orange-500);
    width: 16px;
    height: 16px;
}

.activity-item input[type="checkbox"]:checked + span {
    color: var(--orange-400);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 20px;
}

/* Alert */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Searchable Select */
.searchable-select {
    position: relative;
}

.searchable-input {
    padding-right: 32px !important;
    cursor: text;
}

.searchable-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
}

.searchable-chevron {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: transform 0.2s;
}

.searchable-select:focus-within .searchable-chevron {
    transform: translateY(-50%) rotate(180deg);
}

.searchable-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #1e1e22;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 100;
    display: none;
}

.searchable-dropdown.open {
    display: block;
}

.searchable-item {
    padding: 9px 14px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
}

.searchable-item:hover,
.searchable-item.highlighted {
    background: rgba(249, 115, 22, 0.12);
}

.searchable-item.selected {
    color: var(--orange-400);
    font-weight: 500;
}

.searchable-empty {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.searchable-dropdown::-webkit-scrollbar {
    width: 6px;
}

.searchable-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.searchable-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.searchable-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Required marker */
.required {
    color: var(--orange-400);
    font-weight: 600;
}

/* Input error flash */
.input-error {
    border-color: var(--danger) !important;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Date input styling */
input[type="date"].form-input {
    position: relative;
    cursor: pointer;
}

input[type="date"].form-input::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Profile page */
.profile-section .card-header {
    margin-bottom: 0;
}

.profile-section .card-header .card-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-section .card-header .card-title svg {
    color: var(--orange-400);
    flex-shrink: 0;
}

.profile-display {
    margin-top: 16px;
}

.profile-edit {
    margin-top: 16px;
}

.profile-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.profile-info-grid .info-value:empty::after {
    content: '—';
    color: var(--text-muted);
}

/* Tags */
.tags-section {
    margin-top: 14px;
}

.tags-section .info-label {
    display: block;
    margin-bottom: 8px;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.tag-warning {
    background: rgba(251, 146, 60, 0.15);
    color: var(--orange-400);
    border: 1px solid rgba(251, 146, 60, 0.3);
}

.tag-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.tag-activity {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.tag-removable {
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.tag-removable:hover {
    opacity: 0.7;
    transform: scale(0.95);
}

/* Tags input */
.tags-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tags-input-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 28px;
}

.tags-input-field {
    flex: 1;
}

.form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Empty hint */
.empty-hint {
    color: var(--text-muted);
    font-size: 13px;
    padding: 8px 0;
}

/* Share section */
.share-description {
    margin-top: 12px;
}

.share-description p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.share-controls {
    margin-top: 16px;
}

.share-link-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-link-input {
    flex: 1;
    font-size: 12px !important;
    font-family: 'JetBrains Mono', monospace;
    color: var(--orange-400) !important;
    background: rgba(249, 115, 22, 0.06) !important;
    border-color: rgba(249, 115, 22, 0.2) !important;
}

.btn-danger-text {
    color: var(--danger) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.btn-danger-text:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Shared profile footer */
.shared-footer {
    text-align: center;
    margin-top: 32px;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.shared-footer strong {
    color: var(--orange-400);
}

/* Responsive */
@media (max-width: 640px) {
    .page-wrapper {
        padding: 16px;
    }

    .page-title {
        font-size: 20px;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .trips-grid {
        grid-template-columns: 1fr;
    }

    .trip-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .leg-item {
        flex-wrap: wrap;
    }

    .leg-content {
        order: 5;
        width: 100%;
        margin-top: 6px;
    }

    .activities-grid {
        grid-template-columns: 1fr;
    }

    .popup {
        max-width: 100%;
        margin: 10px;
    }

    .profile-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .share-link-row {
        flex-direction: column;
        align-items: stretch;
    }

    .share-link-row .btn-primary,
    .share-link-row .btn-ghost {
        width: 100%;
        justify-content: center;
    }
}
