/* Window Quote Pro - Dashboard Styles */

:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    --accent: #059669;
    --accent-dark: #047857;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.5;
    min-height: 100vh;
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.auth-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo h1 {
    font-size: 24px;
    color: var(--primary);
    font-weight: 700;
}

.auth-logo p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 4px;
}

.auth-form h2 {
    font-size: 20px;
    margin-bottom: 24px;
    text-align: center;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.form-group input[type="color"] {
    padding: 4px;
    height: 42px;
    cursor: pointer;
}

.form-group .color-preview {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group .color-preview input[type="text"] {
    flex: 1;
}

.form-group .color-preview input[type="color"] {
    width: 50px;
    flex-shrink: 0;
}

.form-group small {
    display: block;
    color: var(--gray-500);
    font-size: 12px;
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

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

.btn-success:hover {
    background: var(--accent-dark);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
}

.btn-block {
    width: 100%;
}

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

.auth-links {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.alert-info {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--gray-900);
    color: white;
    padding: 20px 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--gray-700);
    margin-bottom: 20px;
}

.sidebar-logo h1 {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-logo p {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--gray-300);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    background: var(--gray-800);
    color: white;
}

.sidebar-nav a.active {
    background: var(--primary);
    color: white;
}

.sidebar-nav a svg {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--gray-700);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
}

.subscription-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.subscription-badge.active {
    background: #dcfce7;
    color: #16a34a;
}

.subscription-badge.inactive {
    background: #fef3c7;
    color: #d97706;
}

.subscription-badge.canceled {
    background: #fee2e2;
    color: #dc2626;
}

.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

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

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

.card-body {
    padding: 20px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-change {
    font-size: 12px;
    margin-top: 4px;
}

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

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

/* Tables */
.table-container {
    overflow-x: auto;
}

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

th, td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
}

th {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--gray-50);
}

td {
    font-size: 14px;
}

tbody tr:hover {
    background: var(--gray-50);
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.new {
    background: #dbeafe;
    color: #2563eb;
}

.status-badge.contacted {
    background: #fef3c7;
    color: #d97706;
}

.status-badge.converted {
    background: #dcfce7;
    color: #16a34a;
}

.status-badge.lost {
    background: #fee2e2;
    color: #dc2626;
}

/* Tier Configuration */
.tier-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.tier-header {
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tier-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tier-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.tier-body {
    padding: 16px;
}

.tier-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.tier-features {
    margin-top: 16px;
}

.feature-list {
    list-style: none;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

.feature-list li:last-child {
    border-bottom: none;
}

.feature-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 14px;
    padding: 4px;
}

.feature-input:focus {
    outline: none;
    background: var(--gray-50);
}

.remove-feature {
    color: var(--gray-400);
    cursor: pointer;
}

.remove-feature:hover {
    color: var(--error);
}

/* Pricing Grid */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 16px;
}

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

.pricing-input label {
    display: block;
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.pricing-input input {
    width: 100%;
    padding: 8px;
    text-align: center;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
}

/* Embed Code */
.embed-code {
    background: var(--gray-900);
    color: #e5e7eb;
    padding: 16px;
    border-radius: var(--radius);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    overflow-x: auto;
    position: relative;
}

.embed-code code {
    white-space: pre-wrap;
    word-break: break-all;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--gray-700);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.copy-btn:hover {
    background: var(--gray-600);
}

/* Widget Preview */
.preview-container {
    background: var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    min-height: 400px;
}

.preview-iframe {
    width: 100%;
    height: 600px;
    border: none;
    border-radius: var(--radius);
    background: white;
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background-color: var(--accent);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Modal */
.modal-overlay {
    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: 1000;
    padding: 20px;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-400);
}

.modal-body {
    padding: 20px;
}

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

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

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    color: var(--gray-300);
}

.empty-state h3 {
    font-size: 18px;
    color: var(--gray-700);
    margin-bottom: 8px;
}

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

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

.loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

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

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

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

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 20px;
}

.tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Action buttons in table */
.action-btn {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--gray-500);
    border-radius: 4px;
}

.action-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* Inline edit */
.inline-edit {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-edit input {
    padding: 4px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 14px;
}

/* Volume Discounts */
.discount-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.discount-row input {
    width: 80px;
    padding: 8px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    text-align: center;
}

/* Subscription Card */
.subscription-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.subscription-card h3 {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 4px;
}

.subscription-card .price {
    font-size: 36px;
    font-weight: 700;
}

.subscription-card .price span {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.8;
}

.subscription-card .status {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    font-size: 12px;
    margin-top: 12px;
}

/* Hidden */
.hidden {
    display: none !important;
}
