/* EasyQuote - NkazTech Branding */
:root {
    --purple-dark: #1A0B2E;
    --purple-primary: #8B2FC9;
    --purple-light: #C850C0;
    --purple-deep: #5B21B6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --sidebar-width: 250px;
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.5;
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--purple-dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: relative;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 6px;
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.sidebar-close:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.sidebar-brand h2 {
    font-size: 22px;
    font-weight: 700;
}

.sidebar-brand h2 span {
    color: var(--purple-light);
}

.sidebar-brand .brand-by-sidebar {
    display: block;
    color: var(--purple-light);
    font-size: 11px;
    font-style: italic;
    margin-top: 2px;
}

.sidebar-brand .brand-by-sidebar a {
    color: var(--purple-light);
    text-decoration: none;
}

.sidebar-brand .brand-by-sidebar a:hover {
    text-decoration: underline;
}

.sidebar-brand small {
    color: var(--gray-400);
    font-size: 11px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.sidebar-nav a.active {
    background: var(--purple-primary);
    color: white;
}

.nav-icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.sidebar-footer a {
    color: var(--purple-light);
    text-decoration: none;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    max-width: 1200px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.page-actions {
    display: flex;
    gap: 8px;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    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;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid var(--purple-primary);
}

.stat-card-success {
    border-left-color: var(--success);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--gray-50);
    padding: 10px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
}

.table tr:hover {
    background: var(--gray-50);
}

.table-simple td {
    padding: 8px 12px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-quote { background: #ede9fe; color: var(--purple-deep); }
.badge-invoice { background: #dbeafe; color: #1d4ed8; }
.badge-draft { background: var(--gray-100); color: var(--gray-500); }
.badge-sent { background: #dbeafe; color: #1d4ed8; }
.badge-accepted { background: #d1fae5; color: #065f46; }
.badge-declined { background: #fee2e2; color: #991b1b; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-overdue { background: #fee2e2; color: #991b1b; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--gray-700);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    text-align: center;
}

.btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-primary {
    background: var(--purple-primary);
    color: white;
    border-color: var(--purple-primary);
}

.btn-primary:hover {
    background: var(--purple-deep);
    border-color: var(--purple-deep);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-full {
    display: block;
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--purple-primary);
    box-shadow: 0 0 0 3px rgba(139, 47, 201, 0.1);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-400);
}

/* Status Bar */
.status-bar {
    background: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.status-actions {
    display: flex;
    gap: 8px;
}

/* Quote Preview */
.quote-preview {
    padding: 30px;
}

.quote-preview-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--purple-primary);
}

.quote-type-label {
    color: var(--purple-primary);
    font-size: 28px;
}

.quote-client-info {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.quote-client-info h4 {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.quote-items-table th.text-right,
.quote-items-table td.text-right {
    text-align: right;
}

.quote-totals {
    float: right;
    width: 280px;
    margin: 20px 0;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
}

.totals-total {
    font-weight: 700;
    font-size: 16px;
    color: var(--purple-primary);
    border-bottom: 2px solid var(--purple-primary);
}

.quote-notes,
.quote-terms {
    clear: both;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.quote-notes h4,
.quote-terms h4 {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-bottom: 8px;
}

/* Line Items Table */
.line-items-table input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: 13px;
}

.line-items-table input:focus {
    outline: none;
    border-color: var(--purple-primary);
}

.row-total {
    font-weight: 600;
    white-space: nowrap;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--purple-dark) 0%, #2d1b4e 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px 30px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-brand {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-bottom: 12px;
    border-radius: 8px;
}

.login-brand h1 {
    font-size: 28px;
    color: var(--purple-dark);
}

.login-brand h1 span {
    color: var(--purple-primary);
}

.login-brand p {
    color: var(--gray-400);
    font-size: 13px;
}

.login-brand .brand-by {
    color: var(--purple-primary);
    font-size: 12px;
    margin-bottom: 4px;
}

.login-brand .brand-by a {
    color: var(--purple-primary);
    text-decoration: none;
}

.login-brand .brand-by a:hover {
    text-decoration: underline;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.login-footer p {
    font-size: 13px;
    color: var(--gray-500);
}

.login-footer a {
    color: var(--purple-primary);
    text-decoration: none;
    font-weight: 500;
}

.register-container {
    max-width: 600px;
}

.register-container .login-card {
    padding: 30px 25px;
}

.platform-credit {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

.platform-credit a {
    color: var(--purple-light);
    text-decoration: none;
}

/* Google Button */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    font-weight: 500;
    padding: 10px 16px;
}

.btn-google:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--gray-200);
}

.divider span {
    padding: 0 12px;
    font-size: 12px;
    color: var(--gray-400);
    white-space: nowrap;
}

.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin: 20px 0 12px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.form-section-title:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.input-disabled {
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

.input-readonly {
    background: white;
    color: var(--gray-700);
    cursor: default;
    border-color: var(--gray-200);
}

/* Color Picker */
.color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-input {
    width: 50px;
    height: 38px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 2px;
    cursor: pointer;
}

.color-hex-input {
    width: 90px;
    padding: 8px 10px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: monospace;
}

.color-presets {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.15s;
}

.color-swatch:hover {
    transform: scale(1.2);
}

.form-help {
    display: block;
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

.current-logo {
    margin-bottom: 8px;
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-400); }

/* Mobile Top Bar (hidden on desktop) */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--purple-dark);
    color: white;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
}

.mobile-menu-btn:hover {
    background: rgba(255,255,255,0.1);
}

.mobile-title {
    font-size: 18px;
    font-weight: 700;
}

.mobile-title span {
    color: var(--purple-light);
}

.mobile-title .brand-by {
    font-size: 10px;
    color: var(--purple-light);
    margin-left: 4px;
}

.mobile-title .brand-by a {
    color: var(--purple-light);
    text-decoration: none;
}

.mobile-user {
    width: 32px;
    height: 32px;
    background: var(--purple-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 140;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-topbar {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 150;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        padding-top: 0;
        position: fixed;
        display: flex;
        flex-direction: column;
        background: var(--purple-dark);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 72px 16px 24px;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .page-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .page-actions .btn {
        flex: 1;
        min-width: 0;
        font-size: 12px;
        padding: 8px 12px;
        text-align: center;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-label {
        font-size: 11px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    /* Tables on mobile */
    .table-responsive {
        margin: 0 -16px;
        padding: 0 16px;
    }

    .table th,
    .table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .table .btn-sm {
        padding: 3px 6px;
        font-size: 11px;
    }

    /* Status bar */
    .status-bar {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        padding: 12px 16px;
    }

    .status-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .status-actions .btn {
        flex: 1;
        text-align: center;
        font-size: 11px;
    }

    /* Quote preview */
    .quote-preview {
        padding: 16px;
    }

    .quote-preview-header {
        flex-direction: column;
        gap: 16px;
    }

    .quote-type-label {
        font-size: 22px;
    }

    .quote-totals {
        float: none;
        width: 100%;
    }

    /* Line items on mobile */
    .line-items-table thead {
        display: none;
    }

    .line-items-table tbody tr {
        display: block;
        padding: 12px;
        margin-bottom: 12px;
        border: 1px solid var(--gray-200);
        border-radius: var(--radius);
        background: var(--gray-50);
    }

    .line-items-table tbody td {
        display: block;
        padding: 4px 0;
        border: none;
    }

    .line-items-table tbody td:first-child input {
        font-weight: 500;
        margin-bottom: 8px;
    }

    .line-items-table tbody td:last-child {
        text-align: right;
        margin-top: 8px;
    }

    .line-items-table tbody td .row-total {
        display: block;
        text-align: right;
        font-size: 14px;
    }

    /* Cards */
    .card {
        margin-bottom: 16px;
        border-radius: 6px;
    }

    .card-header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .card-body {
        padding: 16px;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        padding: 20px 16px;
        margin: 10px;
        max-height: 85vh;
    }

    /* Form actions */
    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
        text-align: center;
    }

    /* Color picker */
    .color-picker-row {
        flex-wrap: wrap;
    }

    /* Login/register on mobile */
    .login-container {
        padding: 12px;
    }

    .login-card {
        padding: 24px 20px;
    }

    .register-container {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-actions {
        flex-direction: column;
    }

    .page-actions .btn {
        width: 100%;
    }

    /* Hide less important table columns on tiny screens */
    .table .hide-mobile {
        display: none;
    }
}
