/* ========================================
   WiseLogic - Components & Forms
   Version: 3.0.0
   ======================================== */

/* ========================================
   Login Page - Modern Split Design
   ======================================== */

.login-container {
    height: 100vh;
    max-height: 100vh;
    display: flex;
    background: #0f172a;
    overflow: hidden;
}

/* Left Side - Branding Panel */
.login-branding {
    flex: 1;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.login-branding::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    animation: pulse-bg 15s ease-in-out infinite;
}

@keyframes pulse-bg {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-10%, -10%); }
}

.login-back-btn {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.login-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateX(-2px);
}

.branding-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    z-index: 1;
    max-width: 400px;
    margin: 0 auto;
}

.branding-logo {
    width: 64px;
    height: 64px;
    color: #6366f1;
    margin-bottom: 1.5rem;
}

.branding-logo svg {
    width: 100%;
    height: 100%;
}

.branding-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    margin: 0 0 0.75rem 0;
    letter-spacing: -0.02em;
}

.branding-content > p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.125rem;
    line-height: 1.6;
    margin: 0 0 2.5rem 0;
}

.branding-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.branding-feature {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9375rem;
}

.branding-feature i {
    width: 36px;
    height: 36px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #818cf8;
    font-size: 1rem;
}

.branding-footer {
    position: relative;
    z-index: 1;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.branding-footer p {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8125rem;
    margin: 0;
}

.branding-footer a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: color 0.2s;
}

.branding-footer a:hover {
    color: white;
}

/* Right Side - Login Panel */
.login-panel {
    width: 100%;
    max-width: 480px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 2rem;
    overflow-y: auto;
}

.login-panel-content {
    width: 100%;
    max-width: 360px;
}

.login-header {
    text-align: left;
    margin-bottom: 1.25rem;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.375rem 0;
}

.login-header p {
    color: #64748b;
    font-size: 0.9375rem;
    margin: 0;
}

/* Login Method Toggle */
.login-method-toggle {
    display: flex;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 1rem;
}

.method-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.method-btn:hover {
    color: #334155;
}

.method-btn.active {
    background: white;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.method-btn i {
    font-size: 1rem;
}

/* Login Form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-group label i {
    color: #94a3b8;
    font-size: 0.75rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem 0.875rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.2s;
    font-family: inherit;
    background: #f8fafc;
    color: #0f172a;
}

.form-group input:hover {
    border-color: #cbd5e1;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6366f1;
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-group input::placeholder {
    color: #94a3b8;
}

.form-group small {
    color: #718096;
    font-size: 0.75rem;
}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    width: 100%;
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1rem;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: #6366f1;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.checkbox-label {
    color: #475569 !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.checkbox-label input {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
    cursor: pointer;
}

.checkbox-label span {
    color: #475569 !important;
}

.forgot-link {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* Login Submit Button */
.btn-login-submit {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.btn-login-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.35);
}

.btn-login-submit:active {
    transform: translateY(0);
}

.btn-login-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* QR Code Login Section */
.qr-login-section {
    text-align: center;
}

.qr-instructions {
    background: #f8fafc;
    border-radius: 10px;
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
    text-align: left;
}

.qr-instructions p {
    margin: 0 0 0.5rem 0;
    color: #0f172a;
    font-size: 0.875rem;
}

.qr-instructions ol {
    margin: 0;
    padding-left: 1.125rem;
    color: #475569;
    font-size: 0.8125rem;
    line-height: 1.6;
}

.qr-instructions li {
    margin-bottom: 0.125rem;
}

.qr-code-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.qr-code-wrapper {
    width: 160px;
    height: 160px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.qr-code-wrapper canvas {
    width: 140px !important;
    height: 140px !important;
}

.qr-loading {
    position: absolute;
    inset: 0;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.qr-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.qr-loading span {
    color: #64748b;
    font-size: 0.8125rem;
}

.qr-timer {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: #64748b;
    font-size: 0.8125rem;
}

.qr-timer i {
    color: #94a3b8;
}

.qr-timer strong {
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.btn-refresh-qr {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    color: #475569;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refresh-qr:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Login Divider */
.login-divider {
    text-align: center;
    margin: 0.875rem 0;
    position: relative;
}

.login-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e2e8f0;
}

.login-divider span {
    position: relative;
    background: white;
    padding: 0 1rem;
    color: #94a3b8;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Demo Button */
.btn-demo {
    width: 100%;
    padding: 0.625rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-demo:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #f8fafc;
}

.btn-demo i {
    font-size: 1.125rem;
}

/* Login Help */
.login-help {
    text-align: center;
    margin-top: 1rem;
    padding-top: 0.875rem;
    border-top: 1px solid #f1f5f9;
}

.login-help p {
    margin: 0.5rem 0;
    color: #64748b;
    font-size: 0.875rem;
}

.login-help a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
}

.login-help a:hover {
    text-decoration: underline;
}

.login-help .help-contact {
    font-size: 0.8125rem;
    color: #94a3b8;
}

.login-help .help-contact a {
    color: #64748b;
}

/* Error Message */
.error-message {
    padding: 0.875rem 1rem;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 10px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    border: 1px solid #fecaca;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-message i {
    font-size: 1rem;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .login-container {
        flex-direction: column;
    }

    .login-branding {
        display: none;
    }

    .login-panel {
        max-width: 100%;
        min-height: 100vh;
    }
}

@media (max-width: 480px) {
    .login-panel {
        padding: 1.5rem;
    }

    .login-panel-content {
        max-width: 100%;
    }

    .login-header h2 {
        font-size: 1.5rem;
    }

    .qr-code-wrapper {
        width: 140px;
        height: 140px;
    }

    .qr-code-wrapper canvas {
        width: 120px !important;
        height: 120px !important;
    }
}

/* ========================================
   Forms & Inputs
   ======================================== */

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

/* ========================================
   Data Tables
   ======================================== */

.table-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.table-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.table-actions {
    display: flex;
    gap: 0.75rem;
}

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

.data-table thead {
    background: var(--bg-tertiary);
}

.data-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.table-actions-cell {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-icon.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* ========================================
   Badges & Status
   ======================================== */

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

/* ========================================
   Cards
   ======================================== */

.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.card-header {
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.card-body {
    margin-bottom: 1rem;
}

.card-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ========================================
   Empty State
   ======================================== */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    opacity: 0.5;
}

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

.empty-state-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ========================================
   Notifications/Alerts
   ======================================== */

.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-description {
    font-size: 0.875rem;
    opacity: 0.9;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border: 1px solid var(--info);
}

/* ========================================
   Tabs
   ======================================== */

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    margin-bottom: -2px;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========================================
   Progress Bar
   ======================================== */

.progress {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s;
}

/* ========================================
   Avatars
   ======================================== */

.avatar-group {
    display: flex;
    align-items: center;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    border: 2px solid var(--bg-primary);
    margin-left: -8px;
}

.avatar:first-child {
    margin-left: 0;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 1rem;
}

/* ========================================
   Tooltips
   ======================================== */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
    z-index: 1200;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   Pagination
   ======================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.875rem;
}

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

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

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

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 768px) {
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .table-actions {
        width: 100%;
    }

    .data-table {
        font-size: 0.75rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 1rem;
    }

    .card {
        padding: 1rem;
    }

    .alert {
        padding: 0.875rem 1rem;
    }
}

/* ==========================================
   INVOICING MODULE STYLES
   ========================================== */

/* Invoice Statistics */
.invoice-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1.25rem;
}

.stat-icon.success { background: #dcfce7; color: #16a34a; }
.stat-icon.warning { background: #fef3c7; color: #d97706; }
.stat-icon.danger { background: #fee2e2; color: #dc2626; }

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.stat-label {
    font-size: 0.875rem;
    color: #64748b;
}

/* Invoice Filters */
.invoice-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.filter-group select,
.filter-group input {
    width: 100%;
}

/* Invoices Table */
.invoices-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

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

.invoices-table th {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

.invoices-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.invoices-table tr:hover {
    background: #f8fafc;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-draft { background: #f1f5f9; color: #64748b; }
.status-sent { background: #dbeafe; color: #2563eb; }
.status-viewed { background: #e0e7ff; color: #4f46e5; }
.status-partially_paid { background: #fef3c7; color: #d97706; }
.status-paid { background: #dcfce7; color: #16a34a; }
.status-overdue { background: #fee2e2; color: #dc2626; }
.status-cancelled { background: #f1f5f9; color: #94a3b8; }

/* Type Badges */
.badge-proforma { background: #e0e7ff; color: #4f46e5; }
.badge-corrective { background: #fef3c7; color: #d97706; }
.badge-credit_note { background: #fee2e2; color: #dc2626; }

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-icon.success { color: #16a34a; }
.btn-icon.success:hover { background: #dcfce7; }
.btn-icon.danger { color: #dc2626; }
.btn-icon.danger:hover { background: #fee2e2; }

/* Invoice Modal */
.modal-xl {
    max-width: 1000px;
}

.modal-lg {
    max-width: 800px;
}

/* Form Row */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.col-md-4 { flex: 0 0 33.333%; }
.col-md-6 { flex: 0 0 50%; }
.col-md-12 { flex: 0 0 100%; }

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    .col-md-4, .col-md-6, .col-md-12 {
        flex: 0 0 100%;
    }
}

/* Customer Info Box */
.customer-info-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.customer-info-grid {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Invoice Items Section */
.invoice-items-section {
    margin: 1.5rem 0;
}

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

.section-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #0f172a;
}

/* Items Table */
.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.items-table th {
    background: #f8fafc;
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

.items-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.items-table input,
.items-table select {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.875rem;
}

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

.items-table tfoot .totals-row td {
    padding: 0.5rem;
    background: #f8fafc;
}

.items-table tfoot .grand-total td {
    background: #f1f5f9;
    font-weight: 600;
}

/* Invoice Detail */
.invoice-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.party-box {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
}

.party-box h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
}

.invoice-dates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.invoice-totals {
    margin-top: 1.5rem;
    border-top: 2px solid #e2e8f0;
    padding-top: 1rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.total-row.grand-total {
    border-top: 2px solid #0f172a;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    font-size: 1.125rem;
}

.total-row.paid {
    color: #16a34a;
}

.invoice-notes {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 0.875rem;
}

/* Form Select Small */
.form-select-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Text Utilities */
.text-success { color: #16a34a; }
.text-danger { color: #dc2626; }
.text-muted { color: #64748b; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Button Small */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .invoice-parties {
        grid-template-columns: 1fr;
    }
    
    .invoice-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   Dark Mode - Invoice Complete Styles
   ======================================== */

/* Invoice Statistics Cards */
[data-theme="dark"] .invoice-stats .stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .invoice-stats .stat-value {
    color: var(--text-primary);
}

[data-theme="dark"] .invoice-stats .stat-label {
    color: var(--text-muted);
}

[data-theme="dark"] .invoice-stats .stat-icon {
    background: rgba(102, 126, 234, 0.2);
    color: #818cf8;
}

[data-theme="dark"] .invoice-stats .stat-icon.success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

[data-theme="dark"] .invoice-stats .stat-icon.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

[data-theme="dark"] .invoice-stats .stat-icon.danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Invoice Filters */
[data-theme="dark"] .invoice-filters {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .invoice-filters select,
[data-theme="dark"] .invoice-filters input {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .invoice-filters select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .invoice-filters input::placeholder {
    color: var(--text-muted);
}

/* Invoices Table */
[data-theme="dark"] .invoices-table-container {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .invoices-table {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .invoices-table thead {
    background: var(--bg-primary);
}

[data-theme="dark"] .invoices-table thead th {
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .invoices-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .invoices-table tbody tr:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .invoices-table td {
    color: var(--text-primary);
}

[data-theme="dark"] .invoices-table td small {
    color: var(--text-muted);
}

/* Party Boxes (Supplier/Customer) */
[data-theme="dark"] .party-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .party-box h4 {
    color: var(--text-secondary);
}

/* Invoice Dates */
[data-theme="dark"] .invoice-dates {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* Invoice Totals */
[data-theme="dark"] .invoice-totals {
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .total-row {
    color: var(--text-primary);
}

[data-theme="dark"] .total-row.grand-total {
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .total-row.paid {
    color: #4ade80;
}

/* Invoice Notes */
[data-theme="dark"] .invoice-notes {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* Items Table (Create/Edit Modal) */
[data-theme="dark"] .items-table {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .items-table thead {
    background: var(--bg-primary);
}

[data-theme="dark"] .items-table thead th {
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .items-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .items-table input,
[data-theme="dark"] .items-table select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .items-table input::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .items-table select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .items-table .item-total {
    color: var(--text-primary);
}

[data-theme="dark"] .items-table tfoot {
    background: var(--bg-primary);
}

[data-theme="dark"] .items-table tfoot td {
    color: var(--text-primary);
}

[data-theme="dark"] .totals-row td {
    color: var(--text-primary);
}

/* Customer Info Box */
[data-theme="dark"] .customer-info-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .customer-info-grid {
    color: var(--text-primary);
}

/* Status Badges - Dark Mode */
[data-theme="dark"] .status-badge {
    font-weight: 500;
}

[data-theme="dark"] .status-draft { 
    background: #374151; 
    color: #d1d5db; 
}
[data-theme="dark"] .status-sent { 
    background: #1e3a5f; 
    color: #93c5fd; 
}
[data-theme="dark"] .status-viewed { 
    background: #312e81; 
    color: #c4b5fd; 
}
[data-theme="dark"] .status-partially_paid { 
    background: #78350f; 
    color: #fde047; 
}
[data-theme="dark"] .status-paid { 
    background: #14532d; 
    color: #86efac; 
}
[data-theme="dark"] .status-overdue { 
    background: #7f1d1d; 
    color: #fca5a5; 
}
[data-theme="dark"] .status-cancelled { 
    background: #374151; 
    color: #9ca3af; 
}

/* Modal - Dark Mode */
[data-theme="dark"] .modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-header {
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-header h2 {
    color: var(--text-primary);
}

[data-theme="dark"] .modal-body {
    color: var(--text-primary);
}

[data-theme="dark"] .modal-body p {
    color: var(--text-primary);
}

[data-theme="dark"] .modal-body label {
    color: var(--text-secondary);
}

[data-theme="dark"] .modal-footer {
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

/* Form Elements - Dark Mode */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-input::placeholder,
[data-theme="dark"] .form-textarea::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .form-select option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] .form-group label {
    color: var(--text-secondary);
}

[data-theme="dark"] .form-row {
    color: var(--text-primary);
}

/* Section Headers in Modal */
[data-theme="dark"] .section-header {
    color: var(--text-primary);
}

[data-theme="dark"] .section-header h3 {
    color: var(--text-primary);
}

[data-theme="dark"] .invoice-items-section {
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

/* Data Table Dark Mode */
[data-theme="dark"] .data-table {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .data-table thead {
    background: var(--bg-primary);
}

[data-theme="dark"] .data-table thead th {
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .data-table tbody tr:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .data-table td {
    color: var(--text-primary);
}

/* Action Buttons */
[data-theme="dark"] .action-buttons .btn-icon {
    color: var(--text-muted);
}

[data-theme="dark"] .action-buttons .btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

[data-theme="dark"] .action-buttons .btn-icon.success:hover {
    color: #4ade80;
}

[data-theme="dark"] .action-buttons .btn-icon.danger:hover {
    color: #f87171;
}

/* Empty State */
[data-theme="dark"] .empty-state {
    color: var(--text-primary);
}

[data-theme="dark"] .empty-state-title {
    color: var(--text-primary);
}

[data-theme="dark"] .empty-state-description {
    color: var(--text-muted);
}

[data-theme="dark"] .empty-state-icon {
    color: var(--text-muted);
}

/* Content Header */
[data-theme="dark"] .content-header h1 {
    color: var(--text-primary);
}

[data-theme="dark"] .content-header .text-muted {
    color: var(--text-muted);
}

/* Invoice Detail Modal specific */
[data-theme="dark"] .invoice-detail-header {
    color: var(--text-primary);
}

[data-theme="dark"] .invoice-parties {
    color: var(--text-primary);
}

/* ========================================
   Dark Mode - Components.css Fixes
   ======================================== */

/* Form group inputs/selects - fix hardcoded colors */
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
    background: var(--bg-tertiary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2) !important;
}

[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder {
    color: var(--text-muted) !important;
}

/* Items table inputs/selects */
[data-theme="dark"] .items-table input,
[data-theme="dark"] .items-table select {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .items-table tfoot .totals-row td,
[data-theme="dark"] .items-table tfoot .grand-total td {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

/* Invoices table container */
[data-theme="dark"] .invoices-table-container {
    background: var(--bg-tertiary) !important;
}

/* Filter group */
[data-theme="dark"] .filter-group select,
[data-theme="dark"] .filter-group input {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Document Detail Modal Styles */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-row.full-width {
    grid-column: 1 / -1;
}

.detail-row label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-row span {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.result-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.85rem;
}

.result-badge.success {
    background: var(--success-bg, #dcfce7);
    color: var(--success-text, #166534);
}

.result-badge.danger {
    background: var(--danger-bg, #fee2e2);
    color: var(--danger-text, #991b1b);
}

@media (max-width: 480px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Service/Product Detail */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.detail-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.detail-card h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

.detail-content {
    padding: 1rem;
}

/* Contract Detail Modal */
.contract-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.contract-detail-info .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.contract-detail-info .detail-row label {
    font-weight: 500;
    color: var(--text-secondary);
}

.contract-detail-file h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.file-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

.file-upload-zone:hover,
.file-upload-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.file-upload-zone i {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.file-upload-zone p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.file-upload-zone small {
    color: var(--text-muted);
}

.file-preview-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.file-preview-container i {
    color: #dc2626;
}

.file-preview-container img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 4px;
}

.file-actions {
    display: flex;
    gap: 0.5rem;
}

.modal-medium {
    max-width: 700px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
}

/* Contract item in list - clickable */
.contract-item {
    cursor: pointer;
    transition: all 0.2s ease;
}

.contract-item:hover {
    background: var(--bg-hover);
}

@media (max-width: 768px) {
    .contract-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Contract notes edit */
.detail-row label .btn-icon {
    margin-left: 0.5rem;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
}

#contractNotesEdit textarea {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    font-family: inherit;
    resize: vertical;
}

#contractNotesEdit .mt-1 {
    margin-top: 0.5rem;
}

#contractNotesEdit .ml-1 {
    margin-left: 0.5rem;
}
