/* components.css - UI Components for P2P Gold Lending */

/* ========== LANGUAGE SELECTOR ========== */
.language-selector {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    height: 60px;
    display: flex;
    align-items: center;
}

.language-selector .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-link {
    display: flex;
    align-items: center;
    height: 100%;
    text-decoration: none;
}

.logo-img {
    height: 32px;
    width: auto;
    max-height: 100%;
    object-fit: contain;
    transition: opacity var(--transition-medium);
}

.logo-img:hover {
    opacity: 0.8;
}

.language-wrapper {
    display: flex;
    align-items: center;
    height: 100%;
}

.language-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-right: 0.5rem;
    white-space: nowrap;
}

.language-select {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    min-width: 140px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23fbbf24' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
}

.language-select:focus {
    border-color: var(--accent-gold);
    outline: none;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
}

/* ========== STATS CARDS ========== */
.header-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--border-color);
    transition: var(--transition-medium);
    min-height: 85px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-gold);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-gold);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ========== TAB NAVIGATION ========== */
.tab-container {
    position: relative;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    box-shadow: var(--shadow-md);
}

.tab-navigation {
    display: flex;
    position: relative;
    z-index: var(--z-base);
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 1rem 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition-slow);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    overflow: hidden;
    white-space: nowrap;
    min-height: 70px;
    min-width: 120px;
}

.tab-btn:not(.active):hover {
    background: rgba(251, 191, 36, 0.05);
    color: var(--accent-gold);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.1));
    color: var(--accent-gold);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.2);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.tab-btn.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-gold);
    border-radius: 3px 3px 0 0;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), transparent);
    border-radius: var(--radius-md);
    z-index: -1;
}

.tab-btn .fas {
    font-size: 1.2rem;
    transition: var(--transition-medium);
}

.tab-btn.active .fas {
    transform: scale(1.1);
    color: var(--accent-gold);
}

.tab-btn .tab-text {
    font-size: 0.75rem;
    line-height: 1.2;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-wrap: break-word;
    display: block;
}

.tab-loader {
    display: none;
    margin-left: 8px;
}

.tab-loader-img {
    width: 16px;
    height: 16px;
}

/* ========== FILTER PANEL ========== */
.filter-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: var(--transition-medium);
    overflow: hidden;
}

.filter-panel.collapsed {
    max-height: 60px;
    padding-bottom: 1rem;
}

.filter-panel.expanded {
    max-height: 1000px;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.filter-header h6 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-gold);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-header .filter-toggle {
    background: transparent;
    border: none;
    color: var(--accent-gold);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-medium);
}

.filter-header .filter-toggle:hover {
    background: rgba(251, 191, 36, 0.1);
    transform: rotate(180deg);
}

.filter-header .filter-toggle i {
    font-size: 0.9rem;
    transition: transform var(--transition-medium);
}

.filter-panel.collapsed .filter-toggle i {
    transform: rotate(180deg);
}

.filter-content {
    transition: var(--transition-medium);
    opacity: 1;
    visibility: visible;
}

.filter-panel.collapsed .filter-content {
    opacity: 0;
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group {
    margin-bottom: 0;
}

.form-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}

.form-control, .form-select {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    width: 100%;
    transition: var(--transition-medium);
    min-height: 46px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
    outline: none;
}

/* Placeholder styling */
.form-control::placeholder,
.form-select::placeholder {
    color: var(--text-placeholder);
    opacity: 0.8;
}

.form-control:focus::placeholder,
.form-select:focus::placeholder {
    opacity: 0.6;
}

/* ========== BUTTONS ========== */
.btn {
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: var(--transition-medium);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
}

.btn-primary {
    background: var(--gradient-gold);
    color: var(--bg-dark);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.4);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    min-height: 40px;
}

/* ========== ORDER CARDS ========== */
.orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition-slow);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.3s ease-out;
}

.order-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-gold);
    transform: scaleX(0);
    transition: transform var(--transition-medium);
}

.order-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-gold);
    box-shadow: var(--shadow-lg);
}

.order-card:hover::before {
    transform: scaleX(1);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.order-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--accent-gold);
}

.order-badge {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
}

.order-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

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

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

.detail-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.detail-value.highlight {
    color: var(--accent-gold);
    font-weight: 600;
}

/* ========== ORDER FOOTER WITH BUTTON ON LEFT ========== */
.order-footer {
    display: flex;
    justify-content: space-between; /* Button on left, time on right */
    align-items: center;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.order-footer small {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-left: auto; /* Push time to the right */
}

.order-footer .btn-sm {
    margin-right: auto; /* Keep button on left */
}

/* Mobile responsive footer */
@media (max-width: 400px) {
    .order-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .order-footer .btn-sm {
        width: 100%;
        order: -1; /* Button appears first on mobile */
        margin-right: 0;
    }
    
    .order-footer small {
        text-align: center;
        width: 100%;
        margin-left: 0;
    }
}

/* Status badges */
.status-badge {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 28px;
}

.status-active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.1));
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-completed {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.1));
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-open {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(96, 165, 250, 0.1));
    color: var(--accent-blue);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

/* ========== MODALS ========== */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 1.5rem 1rem;
    background: linear-gradient(to right, rgba(251, 191, 36, 0.05), transparent);
}

.modal-title {
    font-weight: 600;
    color: var(--accent-gold);
    font-size: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    background: linear-gradient(to right, transparent, rgba(251, 191, 36, 0.05));
}

/* Modal placeholder styling */
.modal-body .form-control::placeholder,
.modal-body .form-select::placeholder,
.modal-body textarea::placeholder {
    color: var(--text-placeholder);
    opacity: 0.8;
}

.modal-body .form-control:focus::placeholder,
.modal-body .form-select:focus::placeholder,
.modal-body textarea:focus::placeholder {
    opacity: 0.6;
}

/* ========== FLOATING ACTION BUTTON ========== */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--gradient-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-dark);
    font-size: 1.5rem;
    box-shadow: 0 8px 25px rgba(251, 191, 36, 0.3);
    border: none;
    z-index: var(--z-fixed);
    transition: var(--transition-slow);
    cursor: pointer;
    min-height: 60px;
    min-width: 60px;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 12px 30px rgba(251, 191, 36, 0.4);
}

/* ========== IMAGE UPLOAD & PREVIEW ========== */
.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.image-preview-item {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-color);
    transition: var(--transition-medium);
}

.image-preview-item:hover {
    border-color: var(--accent-gold);
    transform: scale(1.05);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.9;
    transition: var(--transition-medium);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    min-height: 24px;
    min-width: 24px;
}

.remove-image-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.image-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 11px;
    padding: 4px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Upload Progress */
.upload-progress .progress {
    background: var(--bg-dark);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.upload-progress .progress-bar {
    background: var(--gradient-gold);
    transition: width 0.3s ease;
    border-radius: 10px;
}

/* ========== LOADING STATES ========== */
.loading-indicator {
    text-align: center;
    padding: 2.5rem;
    color: var(--text-secondary);
    display: none;
}

.loading-dots {
    display: inline-flex;
    gap: 0.5rem;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent-gold);
    border-radius: 50%;
    animation: loading-dot 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

.load-more-btn {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.05));
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--accent-gold);
    padding: 1rem 2.5rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    margin: 2.5rem auto;
    display: block;
    transition: var(--transition-medium);
    font-size: 1rem;
    min-height: 52px;
    cursor: pointer;
}

.load-more-btn:hover {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.1));
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(251, 191, 36, 0.2);
}

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

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin: 2rem 0;
}

.empty-state i {
    font-size: 3.5rem;
    color: var(--accent-gold);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h5 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 300px;
    margin: 0 auto;
}

/* ========== RESULTS INFO ========== */
.results-info {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    text-align: center;
    padding: 1rem;
    background: var(--bg-dark);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* ========== DETAIL SECTIONS ========== */
.detail-section {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.detail-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    height: 100%;
    transition: var(--transition-medium);
}

.detail-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}

/* ========== TAB CONTENT ========== */
.tab-content-wrapper {
    margin-top: 1.5rem;
    position: relative;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* ========== PAY & CLOSE BUTTON STYLES ========== */
.btn-pay-close {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-pay-close:hover {
    background: linear-gradient(135deg, #0da271, #047857);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-pay-close i {
    color: white;
}

/* Mobile responsive adjustments for the new layout */
@media (max-width: 768px) {
    .order-footer {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .order-footer .btn-sm {
        width: 100%;
        order: -1;
        margin-bottom: 0.5rem;
    }
    
    .order-footer small {
        text-align: center;
        width: 100%;
    }
}

/* Compact cards for better mobile viewing */
.compact-card .order-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
}

.compact-card .order-details {
    margin-bottom: 1rem;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .order-card:hover {
        transform: none;
        border-color: var(--border-color);
    }
    
    .order-card:hover::before {
        transform: scaleX(0);
    }
    
    .order-card:active {
        transform: scale(0.98);
        border-color: var(--accent-gold);
    }
    
    .order-card:active::before {
        transform: scaleX(1);
    }
}