/* RFQ Agent - Reusable Components */
/* Buttons, Cards, Forms, Navigation */

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
    background: var(--primary-orange);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 92, 53, 0.3);
}

/* Secondary Button */
.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-light);
    border-color: var(--border-dark);
}

/* Success Button */
.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

/* Danger Button */
.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #DC2626;
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
}

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

/* ============================================ */
/* CARDS */
/* ============================================ */

.card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-slow);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    color: var(--text-secondary);
}

.card-footer {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
}

/* Stat Card */
.stat-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-slow);
}

.stat-card:hover {
    border-color: var(--primary-orange);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.stat-value {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.stat-change {
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.stat-change.positive {
    color: var(--accent-green);
}

.stat-change.negative {
    color: var(--accent-red);
}

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

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-info {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-neutral {
    background: var(--bg-dark);
    color: var(--text-secondary);
}

/* ============================================ */
/* NAVIGATION */
/* ============================================ */

.nav {
    background: white;
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    list-style: none;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: var(--font-medium);
    transition: color var(--transition-fast);
}

.nav-link:hover {
    color: var(--primary-orange);
}

.nav-link.active {
    color: var(--primary-orange);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: var(--space-2);
}

.status-online {
    background: var(--accent-green);
}

.status-offline {
    background: var(--accent-red);
}

/* ============================================ */
/* SIDEBAR */
/* ============================================ */

.sidebar {
    background: white;
    border-right: 1px solid var(--border-light);
    width: 200px;
    height: calc(100vh - 64px);
    position: fixed;
    top: 64px;
    left: 0;
    overflow-y: auto;
    padding: var(--space-4) var(--space-3);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

/* Scrollbar styling for sidebar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

/* Optional section label */
.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: var(--space-4) var(--space-3) var(--space-2);
    display: block;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-item {
    margin-bottom: var(--space-1);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-3);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.82rem;
    position: relative;
}

.sidebar-link svg {
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.sidebar-link:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.sidebar-link:hover svg {
    opacity: 1;
}

.sidebar-link.active {
    background: #FFF4F0;
    color: var(--primary-orange);
    border: none;
}

.sidebar-link.active svg {
    opacity: 1;
    color: var(--primary-orange);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: #FF5C35;
    border-radius: 0 3px 3px 0;
}

/* ============================================ */
/* TABLES */
/* ============================================ */

.table-container {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

th {
    background: var(--bg-light);
    padding: var(--space-5) var(--space-4);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
}

td {
    padding: var(--space-5) var(--space-4);
    border-top: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
    font-size: var(--text-sm);
}

tr:hover {
    background: var(--bg-light);
}

/* ============================================ */
/* FORMS */
/* ============================================ */

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

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(255, 92, 53, 0.1);
}

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

.form-help {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-2);
}

/* ============================================ */
/* UTILITIES */
/* ============================================ */

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

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

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

.mt-4 {
    margin-top: var(--space-4);
}

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

.my-4 {
    margin-top: var(--space-4);
    margin-bottom: var(--space-4);
}

.mx-4 {
    margin-left: var(--space-4);
    margin-right: var(--space-4);
}

.p-4 {
    padding: var(--space-4);
}

.py-4 {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
}

.px-4 {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-4 {
    gap: var(--space-4);
}

.grid {
    display: grid;
}

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

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {

    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

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

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modalSlide 0.3s ease-out;
    overflow: hidden;
}

@keyframes modalSlide {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 30px 24px 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.modal-close {
    cursor: pointer;
    color: #666;
    font-size: 28px;
    line-height: 1;
}

.modal-close:hover {
    color: #FF5C35;
}

.modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
}

/* Email Detail Specifics */
.email-meta {
    margin-bottom: 24px;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
}

.email-meta-item {
    margin-bottom: 8px;
    font-size: 14px;
}

.email-meta-label {
    font-weight: 600;
    color: #333;
    width: 80px;
    display: inline-block;
}

.email-body-content {
    font-family: inherit;
    white-space: pre-wrap;
    line-height: 1.6;
    color: #444;
}

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

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    background: white;
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 300px;
    border-left: 4px solid var(--primary-orange);
    animation: toastSlideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast-success {
    border-left-color: var(--accent-green);
}

.toast-error {
    border-left-color: var(--accent-red);
}

.toast-info {
    border-left-color: var(--primary-orange);
}

.toast-message {
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.toast-close {
    margin-left: auto;
    cursor: pointer;
    color: var(--text-muted);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastFadeOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ============================================ */
/* ANIMATIONS & SPINNERS */
/* ============================================ */

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

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid #E5E7EB;
    border-top-color: var(--primary-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}