/**
 * Portal Styles
 * Dedicated styles for the client portal pages
 * Extends the main site's design system
 */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

:root {
    --primary: #e21f26;
    --primary-light: #ff4d4d;
    --secondary: #002b45;
    --accent: #f43f5e;
    --background: #050505;
    --surface: #0f1218;
    --surface-light: #1a1d24;
    --text: #ffffff;
    --text-muted: #94a3b8;
    --glass: rgba(15, 18, 24, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --shadow-premium: 0 40px 80px rgba(0, 0, 0, 0.9);
    --transition-smooth: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition: all 0.3s ease;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

/* ============================================
   LAYOUT
   ============================================ */

.portal-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 40px;
}

.portal-logo {
    height: 50px;
}

.portal-logo img {
    height: 100%;
    width: auto;
}

.portal-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.portal-nav a {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.portal-nav a:hover {
    color: var(--text);
}

/* ============================================
   AUTH PAGES (Login, Register, etc.)
   ============================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--background) 0%, var(--surface) 100%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 48px;
    box-shadow: var(--shadow-premium);
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-header .logo {
    height: 60px;
    margin-bottom: 24px;
}

.auth-header h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

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

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(226, 31, 38, 0.15);
}

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

.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 100px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(226, 31, 38, 0.3);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--surface);
    border-color: var(--text-muted);
}

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

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    filter: brightness(1.1);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    filter: brightness(1.1);
}

.btn-block {
    width: 100%;
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 18px 36px;
    font-size: 1rem;
}

/* ============================================
   ALERTS & MESSAGES
   ============================================ */

.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

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

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

/* ============================================
   DASHBOARD
   ============================================ */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.dashboard-title {
    font-size: 2rem;
}

.dashboard-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: 'Bricolage Grotesque', sans-serif;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.card {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--glass-border);
    background: var(--surface-light);
}

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

.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.table th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    background: var(--surface-light);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--surface-light);
}

.table td {
    font-size: 0.9rem;
}

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

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.status-quoted {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.status-accepted {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.status-declined {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.status-countered {
    background: rgba(168, 85, 247, 0.2);
    color: #c4b5fd;
}

/* ============================================
   QUOTE DETAILS
   ============================================ */

.quote-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.quote-info h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.quote-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.quote-section {
    margin-bottom: 32px;
}

.quote-section h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.price-table {
    width: 100%;
    border-collapse: collapse;
}

.price-table td {
    padding: 12px 0;
    border-bottom: 1px solid var(--glass-border);
}

.price-table .item-name {
    color: var(--text);
}

.price-table .item-price {
    text-align: right;
    font-weight: 600;
}

.price-total {
    display: flex;
    justify-content: space-between;
    padding: 20px 0;
    border-top: 2px solid var(--glass-border);
    margin-top: 8px;
}

.price-total-label {
    font-size: 1.1rem;
    font-weight: 700;
}

.price-total-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Bricolage Grotesque', sans-serif;
}

.quote-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.quote-photo {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.quote-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.quote-photo:hover img {
    transform: scale(1.05);
}

.quote-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================
   COUNTER OFFER FORM
   ============================================ */

.counter-form {
    background: var(--surface-light);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    margin-top: 24px;
}

.counter-form h3 {
    margin-bottom: 20px;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   PRICE BUILDER
   ============================================ */

.price-builder {
    margin-bottom: 20px;
}

.price-item-row {
    display: grid;
    grid-template-columns: 1fr 120px 40px;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.price-item-row .form-input {
    margin-bottom: 0;
}

.price-item-remove {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: var(--surface-light);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
}

.price-item-remove:hover {
    background: var(--error);
    color: white;
}

.add-price-item {
    padding: 12px;
    width: 100%;
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.add-price-item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.price-total-display {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    background: var(--surface-light);
    border-radius: 12px;
    margin-top: 16px;
}

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

@media (max-width: 768px) {
    .portal-container {
        padding: 0 16px;
    }

    .auth-card {
        padding: 32px 24px;
    }

    .portal-header {
        flex-wrap: wrap;
        gap: 12px;
        padding: 16px 0;
        margin-bottom: 24px;
    }

    .portal-logo {
        height: 40px;
    }

    .portal-nav {
        gap: 12px;
        width: 100%;
        justify-content: flex-end;
    }

    .portal-nav a {
        font-size: 0.75rem;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 24px;
    }

    .dashboard-title {
        font-size: 1.5rem;
    }

    /* Quote page grid - stack on mobile */
    .quote-header {
        flex-direction: column;
    }

    .quote-info h1 {
        font-size: 1.25rem;
    }

    /* Two column pages - stack on mobile */
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns:2fr 1fr"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }

    .quote-actions {
        width: 100%;
        flex-direction: column;
    }

    .quote-actions .btn {
        width: 100%;
    }

    .price-item-row {
        grid-template-columns: 1fr;
    }

    /* Cards - reduce padding */
    .card-header {
        padding: 16px;
    }

    .card-body {
        padding: 16px;
    }

    .card-footer {
        padding: 12px 16px;
    }

    /* Stats grid - single column on mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 24px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    /* Counter form */
    .counter-form {
        padding: 16px;
    }

    /* Price display */
    .price-total-value {
        font-size: 1.25rem;
    }

    /* Empty states */
    .empty-state {
        padding: 40px 16px;
    }

    .empty-state-icon {
        font-size: 3rem;
    }

    /* Tables - scroll horizontally */
    .table th,
    .table td {
        padding: 12px 8px;
        font-size: 0.8rem;
    }

    /* Buttons on mobile */
    .btn {
        padding: 12px 20px;
        font-size: 0.8rem;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 0.7rem;
    }
}

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

.hidden {
    display: none !important;
}

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

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

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

.text-success {
    color: var(--success);
}

.text-error {
    color: var(--error);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.mb-4 {
    margin-bottom: 32px;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mt-4 {
    margin-top: 32px;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 16px;
}

.gap-3 {
    gap: 24px;
}