/**
 * Trip Planner Portal - Frontend Styles
 */

/* CSS Variables */
:root {
    --tpp-primary: #3498db;
    --tpp-primary-hover: #2980b9;
    --tpp-secondary: #6c757d;
    --tpp-success: #28a745;
    --tpp-warning: #ffc107;
    --tpp-danger: #dc3545;
    --tpp-info: #17a2b8;
    --tpp-light: #f8f9fa;
    --tpp-dark: #343a40;
    --tpp-white: #ffffff;
    --tpp-border: #dee2e6;
    --tpp-text: #333333;
    --tpp-text-muted: #6c757d;
    --tpp-shadow: 0 2px 4px rgba(0,0,0,0.1);
    --tpp-radius: 8px;
    --tpp-radius-sm: 4px;
}

/* Base Container */
.tpp-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--tpp-text);
    line-height: 1.6;
}

/* Cards */
.tpp-card {
    background: var(--tpp-white);
    border-radius: var(--tpp-radius);
    box-shadow: var(--tpp-shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.tpp-card h3 {
    margin: 0 0 16px;
    font-size: 18px;
    color: var(--tpp-dark);
}

.tpp-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.tpp-card-header h3 {
    margin: 0;
}

/* Buttons */
.tpp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--tpp-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.tpp-btn-primary {
    background: var(--tpp-primary);
    color: var(--tpp-white);
}

.tpp-btn-primary:hover {
    background: var(--tpp-primary-hover);
}

.tpp-btn-secondary {
    background: var(--tpp-light);
    color: var(--tpp-text);
    border: 1px solid var(--tpp-border);
}

.tpp-btn-secondary:hover {
    background: var(--tpp-border);
}

.tpp-btn-text {
    background: transparent;
    color: var(--tpp-primary);
}

.tpp-btn-text:hover {
    text-decoration: underline;
}

.tpp-btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.tpp-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.tpp-btn-block {
    display: block;
    width: 100%;
    margin-bottom: 10px;
}

.tpp-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form Elements */
.tpp-form-group {
    margin-bottom: 20px;
}

.tpp-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--tpp-dark);
}

.tpp-form-group input[type="text"],
.tpp-form-group input[type="email"],
.tpp-form-group input[type="number"],
.tpp-form-group input[type="date"],
.tpp-form-group input[type="password"],
.tpp-form-group textarea,
.tpp-form-group select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--tpp-border);
    border-radius: var(--tpp-radius-sm);
    transition: border-color 0.2s;
}

.tpp-form-group input:focus,
.tpp-form-group textarea:focus,
.tpp-form-group select:focus {
    outline: none;
    border-color: var(--tpp-primary);
}

.tpp-form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--tpp-text-muted);
}

.tpp-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.required {
    color: var(--tpp-danger);
}

/* Radio & Checkbox */
.tpp-radio-group,
.tpp-checkbox-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tpp-radio-inline {
    flex-direction: row;
    gap: 20px;
}

.tpp-radio,
.tpp-checkbox {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
}

.tpp-radio input,
.tpp-checkbox input {
    margin-right: 10px;
    margin-top: 4px;
}

.tpp-radio-label {
    display: flex;
    flex-direction: column;
}

.tpp-radio-label small {
    color: var(--tpp-text-muted);
    font-size: 12px;
}

.tpp-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

/* Status Badges */
.tpp-status-badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
    text-transform: uppercase;
}

.tpp-status-draft { background: #e9ecef; color: #495057; }
.tpp-status-submitted { background: #cce5ff; color: #004085; }
.tpp-status-in_review { background: #fff3cd; color: #856404; }
.tpp-status-offer_sent { background: #e2d4f0; color: #6f42c1; }
.tpp-status-accepted { background: #d4edda; color: #155724; }
.tpp-status-changes_requested { background: #ffe5d0; color: #c45000; }
.tpp-status-expired { background: #f8d7da; color: #721c24; }
.tpp-status-cancelled { background: #f8d7da; color: #721c24; }

/* Wizard */
.tpp-wizard-header {
    text-align: center;
    margin-bottom: 30px;
}

.tpp-wizard-header h1 {
    margin: 0 0 10px;
    font-size: 28px;
}

.tpp-wizard-header p {
    color: var(--tpp-text-muted);
    margin: 0;
}

.tpp-wizard-progress {
    margin-bottom: 30px;
}

.tpp-progress-bar {
    height: 4px;
    background: var(--tpp-border);
    border-radius: 2px;
    margin-bottom: 10px;
}

.tpp-progress-fill {
    height: 100%;
    background: var(--tpp-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.tpp-progress-steps {
    display: flex;
    justify-content: space-between;
}

.tpp-progress-steps .tpp-step {
    font-size: 12px;
    color: var(--tpp-text-muted);
}

.tpp-progress-steps .tpp-step.active {
    color: var(--tpp-primary);
    font-weight: 600;
}

.tpp-wizard-step {
    display: none;
}

.tpp-wizard-step.active {
    display: block;
}

.tpp-wizard-step h2 {
    margin: 0 0 20px;
    font-size: 22px;
}

.tpp-wizard-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--tpp-border);
}

/* Dashboard */
.tpp-dashboard-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.tpp-dashboard-header h1 {
    margin: 0;
}

/* Summary Grid */
.tpp-summary-grid,
.tpp-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.tpp-summary-item,
.tpp-info-item {
    display: flex;
    flex-direction: column;
}

.tpp-info-full {
    grid-column: 1 / -1;
}

.tpp-label {
    font-size: 12px;
    color: var(--tpp-text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.tpp-value {
    font-size: 14px;
    color: var(--tpp-text);
}

/* Timeline */
.tpp-timeline-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
}

.tpp-timeline-steps::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--tpp-border);
}

.tpp-timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.tpp-timeline-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--tpp-white);
    border: 2px solid var(--tpp-border);
    margin-bottom: 8px;
}

.tpp-timeline-step.complete .tpp-timeline-dot {
    background: var(--tpp-success);
    border-color: var(--tpp-success);
}

.tpp-timeline-step.active .tpp-timeline-dot {
    background: var(--tpp-primary);
    border-color: var(--tpp-primary);
}

.tpp-timeline-step span {
    font-size: 12px;
    color: var(--tpp-text-muted);
}

.tpp-timeline-step.active span {
    color: var(--tpp-primary);
    font-weight: 600;
}

/* Itinerary */
.tpp-itinerary-days {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tpp-itinerary-day {
    padding: 16px;
    background: var(--tpp-light);
    border-radius: var(--tpp-radius-sm);
}

.tpp-day-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.tpp-day-number {
    font-weight: 600;
    color: var(--tpp-primary);
}

.tpp-day-location {
    color: var(--tpp-text-muted);
}

.tpp-day-blocks {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tpp-activity-block {
    display: flex;
    gap: 12px;
}

.tpp-activity-time {
    min-width: 80px;
    font-weight: 500;
    color: var(--tpp-secondary);
}

.tpp-day-options,
.tpp-day-accommodation {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--tpp-border);
    font-size: 13px;
    color: var(--tpp-text-muted);
}

/* Loading & Messages */
.tpp-loading {
    text-align: center;
    padding: 40px;
}

.tpp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--tpp-border);
    border-top-color: var(--tpp-primary);
    border-radius: 50%;
    animation: tpp-spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes tpp-spin {
    to { transform: rotate(360deg); }
}

.tpp-message {
    padding: 12px 16px;
    border-radius: var(--tpp-radius-sm);
    margin: 16px 0;
}

.tpp-message.success {
    background: #d4edda;
    color: #155724;
}

.tpp-message.error {
    background: #f8d7da;
    color: #721c24;
}

/* Notices */
.tpp-notice {
    padding: 12px 16px;
    border-radius: var(--tpp-radius-sm);
    margin-bottom: 16px;
}

.tpp-notice-success {
    background: #d4edda;
    color: #155724;
}

.tpp-notice-error {
    background: #f8d7da;
    color: #721c24;
}

/* Portal Header */
.tpp-portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--tpp-border);
}

.tpp-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tpp-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tpp-back-link {
    color: var(--tpp-text-muted);
    text-decoration: none;
}

.tpp-back-link:hover {
    color: var(--tpp-primary);
}

.tpp-role-badge {
    font-size: 10px;
    background: var(--tpp-primary);
    color: var(--tpp-white);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

/* Filters Bar */
.tpp-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    padding: 16px;
    background: var(--tpp-light);
    border-radius: var(--tpp-radius);
    margin-bottom: 20px;
}

.tpp-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tpp-filter-group label {
    font-size: 12px;
    color: var(--tpp-text-muted);
}

.tpp-filter-group select,
.tpp-filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--tpp-border);
    border-radius: var(--tpp-radius-sm);
    min-width: 150px;
}

.tpp-search-group {
    flex: 1;
    min-width: 200px;
}

/* Table */
.tpp-requests-table-wrapper {
    overflow-x: auto;
}

.tpp-requests-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--tpp-white);
    border-radius: var(--tpp-radius);
    overflow: hidden;
    box-shadow: var(--tpp-shadow);
}

.tpp-requests-table th,
.tpp-requests-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--tpp-border);
}

.tpp-requests-table th {
    background: var(--tpp-light);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--tpp-text-muted);
}

.tpp-requests-table tbody tr:hover {
    background: var(--tpp-light);
}

.tpp-loading-row td {
    text-align: center;
    padding: 40px;
    color: var(--tpp-text-muted);
}

/* Pagination */
.tpp-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.tpp-page-info {
    color: var(--tpp-text-muted);
    font-size: 14px;
}

/* Detail Layout */
.tpp-detail-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
}

.tpp-detail-main {
    min-width: 0;
}

.tpp-detail-sidebar .tpp-card {
    position: sticky;
    top: 20px;
}

/* Messages */
.tpp-messages-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.tpp-message-item {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: var(--tpp-radius-sm);
    background: var(--tpp-light);
}

.tpp-message-item.customer {
    background: #e3f2fd;
}

.tpp-message-item.advisor {
    background: #f3e5f5;
}

.tpp-message-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--tpp-text-muted);
    margin-bottom: 4px;
}

.tpp-message-body {
    font-size: 14px;
}

.tpp-message-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--tpp-border);
    border-radius: var(--tpp-radius-sm);
    resize: vertical;
    margin-bottom: 8px;
}

.tpp-no-messages {
    color: var(--tpp-text-muted);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Audit Log */
.tpp-audit-log {
    max-height: 300px;
    overflow-y: auto;
}

.tpp-audit-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--tpp-border);
    font-size: 13px;
}

.tpp-audit-item:last-child {
    border-bottom: none;
}

.tpp-audit-time {
    font-size: 11px;
    color: var(--tpp-text-muted);
}

/* Modal */
.tpp-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.tpp-modal-content {
    background: var(--tpp-white);
    border-radius: var(--tpp-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.tpp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--tpp-border);
}

.tpp-modal-header h3 {
    margin: 0;
}

.tpp-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--tpp-text-muted);
}

.tpp-modal-body {
    padding: 20px;
}

.tpp-modal-body textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--tpp-border);
    border-radius: var(--tpp-radius-sm);
}

.tpp-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--tpp-border);
}

/* Login Page */
.tpp-login-page {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpp-login-box {
    width: 100%;
    max-width: 400px;
    background: var(--tpp-white);
    border-radius: var(--tpp-radius);
    box-shadow: var(--tpp-shadow);
    padding: 40px;
}

.tpp-login-header {
    text-align: center;
    margin-bottom: 30px;
}

.tpp-login-header h1 {
    margin: 0 0 8px;
}

.tpp-login-header p {
    color: var(--tpp-text-muted);
    margin: 0;
}

.tpp-login-footer {
    text-align: center;
    margin-top: 20px;
}

.tpp-login-form-wrapper #tpp-login-form p {
    margin-bottom: 16px;
}

.tpp-login-form-wrapper #tpp-login-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.tpp-login-form-wrapper #tpp-login-form input[type="text"],
.tpp-login-form-wrapper #tpp-login-form input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--tpp-border);
    border-radius: var(--tpp-radius-sm);
}

.tpp-login-form-wrapper #tpp-login-form input[type="submit"] {
    width: 100%;
    padding: 12px;
    background: var(--tpp-primary);
    color: var(--tpp-white);
    border: none;
    border-radius: var(--tpp-radius-sm);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

.tpp-login-form-wrapper #tpp-login-form input[type="submit"]:hover {
    background: var(--tpp-primary-hover);
}

/* Error Container */
.tpp-error-container {
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpp-error-box {
    text-align: center;
    padding: 40px;
}

.tpp-error-box h2 {
    margin: 0 0 16px;
}

.tpp-error-box p {
    color: var(--tpp-text-muted);
    margin-bottom: 24px;
}

/* Disclaimer */
.tpp-disclaimer {
    padding: 16px;
    background: var(--tpp-light);
    border-radius: var(--tpp-radius-sm);
    font-size: 13px;
    color: var(--tpp-text-muted);
    margin: 20px 0;
}

/* Offer Actions */
.tpp-offer-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 30px;
}

/* Responsive */
@media (max-width: 768px) {
    .tpp-container {
        padding: 16px;
    }

    .tpp-form-row {
        grid-template-columns: 1fr;
    }

    .tpp-detail-layout {
        grid-template-columns: 1fr;
    }

    .tpp-filters-bar {
        flex-direction: column;
    }

    .tpp-filter-group {
        width: 100%;
    }

    .tpp-filter-group select,
    .tpp-filter-group input {
        width: 100%;
    }

    .tpp-portal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .tpp-offer-actions {
        flex-direction: column;
    }

    .tpp-timeline-steps {
        flex-wrap: wrap;
        gap: 10px;
    }
}
