/**
 * Customer Portal System - Modern Minimalist UI
 * Premium Design with Glassmorphism & Micro-animations
 */

/* ========================================
   CSS Variables - Modern Color System
   ======================================== */
:root {
    /* Primary Palette - Vivid Blue */
    --primary-50: #fbddea;
    --primary-100: #fcdae8;
    --primary-200: #f7c1d7;
    --primary-300: #f7aaca;
    --primary-400: #f84891;
    --primary-500: #fb3286;
    --primary-600: #ff006a;
    --primary-700: #ff006a;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    --primary-color: #fb3286;
    --primary-hover: #ff006a;
    --primary-light: rgba(37, 99, 235, 0.1);

    /* Accent Colors */
    --accent-green: #10b981;
    --accent-green-light: rgba(16, 185, 129, 0.1);
    --accent-amber: #f59e0b;
    --accent-amber-light: rgba(245, 158, 11, 0.1);
    --accent-red: #ef4444;
    --accent-red-light: rgba(239, 68, 68, 0.1);
    --accent-purple: #8b5cf6;
    --accent-purple-light: rgba(139, 92, 246, 0.1);
    --accent-cyan: #06b6d4;
    --accent-cyan-light: rgba(6, 182, 212, 0.1);

    /* Neutral Colors */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    /* Semantic Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #0f172a;
    --bg-dark-secondary: #1e293b;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-white: #ffffff;

    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Design Tokens */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    --sidebar-width: 280px;
    --header-height: 70px;

    /* Shadows - Modern Elevation System */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.04);

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-blur: blur(12px);

    /* Transitions */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 350ms;
}

/* ========================================
   Reset & Base Styles
   ======================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--slate-50) 0%, var(--slate-100) 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-smooth);
}

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

::selection {
    background: var(--primary-200);
    color: var(--primary-900);
}

/* ========================================
   Login Page - Premium Design
   ======================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:white;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, -30px) rotate(5deg);
    }

    66% {
        transform: translate(-20px, 20px) rotate(-5deg);
    }
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl), 0 0 40px rgba(0, 0, 0, 0.1);
    padding: 3rem;
    animation: slideUp 0.6s var(--ease-bounce);
}

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

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

.login-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo-img {
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.login-logo i {
    font-size: 3.5rem;
    background: linear-gradient(135deg, var(--primary-500), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 0.75rem;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.login-form .form-label {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.login-form .form-control {
    padding: 0.875rem 1.125rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    background: var(--bg-primary);
    transition: all var(--duration-normal) var(--ease-smooth);
}

.login-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light);
    outline: none;
}

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

.login-form .btn-primary {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    border: none;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transition: all var(--duration-normal) var(--ease-smooth);
}

.login-form .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
}

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

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

/* Sidebar - Minimalist White Design */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

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

.sidebar::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: var(--radius-full);
}

.sidebar-brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo-img {
    max-width: 140px;
    height: auto;
    transition: opacity var(--duration-fast);
}

.sidebar-logo-img:hover {
    opacity: 0.8;
}

.sidebar-brand i {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary-400), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-brand span {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.sidebar-user {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar i {
    font-size: 1.25rem;
    color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 0.25rem;
}

.nav-section-title {
    display: block;
    padding: 0.75rem 1.5rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    margin: 0.125rem 0.75rem;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--duration-fast) var(--ease-smooth);
}

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

.sidebar-nav .nav-link.active {
    color: var(--primary-color);
    background: var(--primary-50);
    font-weight: 600;
}

.sidebar-nav .nav-link i {
    font-size: 1.125rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border-color);
}

.logout-link {
    color: var(--accent-red) !important;
}

.logout-link:hover {
    background: var(--accent-red-light) !important;
    color: var(--accent-red) !important;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 2.5rem;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--slate-50) 0%, var(--slate-100) 100%);
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* ========================================
   Cards - Modern Elevated Design
   ======================================== */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration-normal) var(--ease-smooth);
    overflow: hidden;
}

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

.card-header {
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
}

/* Stats Cards - Premium Design */
.stats-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-smooth);
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    opacity: 0.05;
    transform: translate(30%, -30%);
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stats-card .stats-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    position: relative;
}

.stats-card .stats-icon.bg-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.stats-card .stats-icon.bg-success {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.stats-card .stats-icon.bg-warning {
    background: linear-gradient(135deg, var(--accent-amber), #d97706);
    color: white;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.stats-card .stats-icon.bg-danger {
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.stats-card .stats-icon.bg-info {
    background: linear-gradient(135deg, var(--accent-cyan), #0891b2);
    color: white;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}

.stats-card .stats-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.stats-card .stats-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 0.375rem;
}

/* ========================================
   Tables - Clean Modern Design
   ======================================== */
.table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    white-space: nowrap;
}

.table thead th:first-child {
    border-top-left-radius: var(--radius-lg);
}

.table thead th:last-child {
    border-top-right-radius: var(--radius-lg);
}

.table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    transition: background var(--duration-fast);
}

.table-hover tbody tr:hover td {
    background-color: var(--primary-50);
}

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

/* ========================================
   Buttons - Premium Styling
   ======================================== */
.btn {
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-lg);
    transition: all var(--duration-fast) var(--ease-smooth);
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    border: none;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green) 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    color: white;
}

.btn-outline-primary {
    color: var(--primary-color);
    background: transparent;
    border: 2px solid var(--primary-200);
}

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

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

.btn-outline-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--slate-300);
    color: var(--text-primary);
}

.btn-outline-success {
    color: var(--accent-green);
    background: transparent;
    border: 2px solid rgba(16, 185, 129, 0.3);
}

.btn-outline-success:hover {
    background: var(--accent-green-light);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn-outline-danger {
    color: var(--accent-red);
    background: transparent;
    border: 2px solid rgba(239, 68, 68, 0.3);
}

.btn-outline-danger:hover {
    background: var(--accent-red-light);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.btn-group {
    display: flex;
    gap: 0.375rem;
}

.btn-group .btn {
    border-radius: var(--radius-md);
}

/* ========================================
   Forms - Modern Minimalist
   ======================================== */
.form-label {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control,
.form-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--duration-fast) var(--ease-smooth);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--slate-300);
}

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

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

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

/* ========================================
   Badges - Pill Style
   ======================================== */
.badge {
    font-weight: 600;
    font-size: 0.6875rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.bg-paid,
.badge.bg-completed,
.badge.bg-active {
    background: var(--accent-green-light) !important;
    color: var(--accent-green);
}

.badge.bg-unpaid,
.badge.bg-pending {
    background: var(--accent-amber-light) !important;
    color: var(--accent-amber);
}

.badge.bg-overdue {
    background: var(--accent-red-light) !important;
    color: var(--accent-red);
}

.badge.bg-in-progress {
    background: var(--primary-light) !important;
    color: var(--primary-color);
}

.badge.bg-expired,
.badge.bg-cancelled {
    background: rgba(100, 116, 139, 0.1) !important;
    color: var(--slate-500);
}

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

.badge.bg-success {
    background: var(--accent-green-light) !important;
    color: var(--accent-green);
}

.badge.bg-info {
    background: var(--accent-cyan-light) !important;
    color: var(--accent-cyan);
}

/* ========================================
   Modal - Glass Effect
   ======================================== */
.modal-backdrop {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    animation: modalSlide 0.3s var(--ease-bounce);
}

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

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

.modal-header {
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-title i {
    color: var(--primary-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.btn-close {
    opacity: 0.5;
    transition: opacity var(--duration-fast);
}

.btn-close:hover {
    opacity: 1;
}

/* ========================================
   Invoice Styles - Premium Layout
   ======================================== */
.invoice-preview {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-sm);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.invoice-logo h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

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

.invoice-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

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

.invoice-table {
    margin-bottom: 2rem;
}

.invoice-table th {
    background: var(--bg-secondary);
    font-size: 0.75rem;
    font-weight: 700;
}

.invoice-total {
    text-align: right;
    padding-top: 1.5rem;
    border-top: 3px solid var(--border-color);
}

.invoice-total .total-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.invoice-total .total-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

/* ========================================
   Alerts - Modern Style
   ======================================== */
.alert {
    border: none;
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: var(--accent-green-light);
    color: #047857;
}

.alert-danger {
    background: var(--accent-red-light);
    color: #b91c1c;
}

.alert-warning {
    background: var(--accent-amber-light);
    color: #b45309;
}

.alert-info {
    background: var(--accent-cyan-light);
    color: #0e7490;
}

.alert-dismissible .btn-close {
    padding: 1rem;
}

/* ========================================
   Invoice Items Form
   ======================================== */
.invoice-item-row {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.invoice-item-row:hover {
    border-color: var(--primary-200);
    background: var(--primary-50);
}

.invoice-item-row .btn-remove-item {
    color: var(--accent-red);
    border-color: transparent;
}

.invoice-item-row .btn-remove-item:hover {
    background: var(--accent-red-light);
}

.item-amount-display {
    font-weight: 700;
    color: var(--primary-color);
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i {
    font-size: 5rem;
    background: linear-gradient(135deg, var(--slate-300), var(--slate-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
}

.empty-state h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   Progress Bars
   ======================================== */
.progress {
    height: 0.5rem;
    border-radius: var(--radius-full);
    background-color: var(--bg-tertiary);
    overflow: hidden;
}

.progress-bar {
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
    transition: width 0.6s ease;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--duration-normal) var(--ease-smooth);
        box-shadow: var(--shadow-2xl);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .mobile-toggle {
        display: block !important;
    }
}

@media (max-width: 767.98px) {
    .main-content {
        padding: 1rem;
    }

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

    .stats-card {
        padding: 1.25rem;
    }

    .stats-card .stats-value {
        font-size: 1.5rem;
    }

    .invoice-header {
        flex-direction: column;
        gap: 1.5rem;
    }

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

    .invoice-details {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .invoice-preview {
        padding: 1.5rem;
    }

    .login-card {
        padding: 2rem;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1002;
    width: 48px;
    height: 48px;
    background: var(--bg-primary);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
    align-items: center;
    justify-content: center;
}

.mobile-toggle i {
    font-size: 1.5rem;
    color: var(--text-primary);
    transition: transform var(--duration-fast);
}

.mobile-toggle:hover {
    background: var(--bg-secondary);
    box-shadow: var(--shadow-xl);
}

.mobile-toggle.active {
    background: var(--primary-color);
}

.mobile-toggle.active i {
    color: white;
    transform: rotate(90deg);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-smooth);
}

.sidebar-overlay.show {
    opacity: 1;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    z-index: 1001;
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.mobile-header-logo {
    display: flex;
    align-items: center;
}

.mobile-header-logo img {
    height: 32px;
    width: auto;
}

@media (max-width: 991.98px) {
    .mobile-header {
        display: flex;
    }

    .mobile-toggle {
        position: static;
        display: flex;
        box-shadow: none;
        background: transparent;
    }

    .mobile-toggle:hover {
        background: var(--bg-secondary);
    }

    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }

    .sidebar-overlay.show {
        pointer-events: auto;
    }

    .main-content {
        padding-top: 5rem;
    }
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.fw-medium {
    font-weight: 500;
}

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

/* Animation Utilities */
.animate-fade-in {
    animation: fadeIn 0.3s var(--ease-smooth);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-slide-up {
    animation: slideUp 0.4s var(--ease-bounce);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--slate-400);
}

/* Focus Visible for Accessibility */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ========================================
   Mobile Responsive Styles
   ======================================== */

/* Mobile First - Small Devices */
@media (max-width: 575.98px) {

    /* Page Header */
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .page-header .btn {
        width: 100%;
    }

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

    /* Cards */
    .card {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .card-body {
        padding: 1rem;
    }

    /* Tables - Responsive Card View */
    .table-responsive {
        border: none;
    }

    .table thead {
        display: none;
    }

    .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        padding: 1rem;
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
    }

    .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid var(--border-light);
    }

    .table tbody td:last-child {
        border-bottom: none;
        padding-top: 1rem;
        justify-content: flex-end;
    }

    .table tbody td::before {
        content: attr(data-label);
        font-weight: 500;
        color: var(--text-secondary);
        font-size: 0.875rem;
    }

    /* Summary Cards */
    .row .col-md-4,
    .row .col-md-3,
    .row .col-lg-3 {
        margin-bottom: 1rem;
    }

    /* Stats Cards on Dashboard */
    .stats-card {
        padding: 1rem;
    }

    .stats-card h3 {
        font-size: 1.5rem;
    }

    /* Modals */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    .modal-lg {
        max-width: 100%;
    }

    /* Forms */
    .row.g-3>[class*="col-"] {
        margin-bottom: 0.75rem;
    }

    .form-control,
    .form-select {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    /* Button Groups */
    .btn-group {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .btn-group .btn {
        border-radius: var(--radius-md) !important;
    }

    /* Filter Buttons */
    .card .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    .card .d-flex.gap-2 .btn {
        flex: 1 1 auto;
        min-width: 80px;
    }

    /* Quotation Items */
    .quotation-item .row {
        flex-direction: column;
    }

    .quotation-item .row>div {
        margin-bottom: 0.5rem;
    }

    .quotation-item .col-md-1 {
        align-self: flex-end;
    }

    /* Empty State */
    .empty-state {
        padding: 2rem 1rem;
    }

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

    /* Main Content Padding */
    .main-content {
        padding: 1rem;
        padding-top: 5rem;
    }

    /* Hide certain columns on mobile */
    .hide-mobile {
        display: none !important;
    }
}

/* Medium Devices - Tablets */
@media (min-width: 576px) and (max-width: 991.98px) {
    .page-header {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .table td,
    .table th {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }

    .modal-lg {
        max-width: 90%;
    }

    .main-content {
        padding: 1.5rem;
        padding-top: 5.5rem;
    }
}

/* Touch Device Improvements */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .btn {
        min-height: 44px;
        padding: 0.625rem 1rem;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 0.75rem;
    }

    .nav-link {
        padding: 0.875rem 1rem;
    }

    .form-control,
    .form-select {
        min-height: 44px;
    }

    /* Remove hover effects that don't work on touch */
    .btn:hover {
        transform: none;
    }

    .card:hover {
        transform: none;
    }
}

/* Landscape Mobile */
@media (max-width: 991.98px) and (orientation: landscape) {
    .modal-content {
        min-height: auto;
    }

    .modal-dialog {
        height: auto;
        margin: 1rem;
    }
}

/* Better Table Scrolling */
@media (max-width: 767.98px) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* Action buttons stack */
    .table .btn-group {
        display: flex;
        flex-direction: row;
        gap: 0.25rem;
    }
}

/* Dashboard Stats Grid */
@media (max-width: 575.98px) {
    .row[class*="g-4"] {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }

    /* Project Cards Grid */
    .row.g-4>.col-md-6,
    .row.g-4>.col-lg-4 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Status Summary Cards */
    .row.g-3>.col-6 {
        padding-left: 0.375rem;
        padding-right: 0.375rem;
    }

    .row.g-3>.col-6 .card-body {
        padding: 0.75rem;
    }

    .row.g-3>.col-6 h3 {
        font-size: 1.25rem;
    }

    /* Breadcrumb */
    .breadcrumb {
        font-size: 0.875rem;
        padding: 0.5rem 0;
    }

    /* Badge Wrap */
    .d-flex.gap-2.flex-wrap .badge {
        font-size: 0.7rem;
        padding: 0.35em 0.65em;
    }

    /* Dropdown Menus */
    .dropdown-menu {
        font-size: 0.875rem;
    }

    /* Timeline in History Modal */
    .timeline-item {
        font-size: 0.875rem;
    }

    /* Verify Button on Table */
    .table .btn-group {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.25rem;
    }

    .table .btn-group .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Page Subtitle */
    .page-subtitle {
        font-size: 0.875rem;
        word-break: break-word;
    }

    /* Card Header */
    .card-header {
        padding: 0.75rem 1rem;
    }

    .card-header h5 {
        font-size: 1rem;
    }

    /* Card Footer */
    .card-footer {
        padding: 0.75rem 1rem;
    }

    /* Form Labels */
    .form-label {
        font-size: 0.875rem;
    }

    /* Alert */
    .alert {
        padding: 0.75rem;
        font-size: 0.875rem;
    }

    /* Radio Buttons in Verify Modal */
    .form-check-inline {
        margin-right: 0.5rem;
    }

    .form-check-label {
        font-size: 0.875rem;
    }
}

/* Better Table on Medium Screens */
@media (min-width: 576px) and (max-width: 767.98px) {

    .table td,
    .table th {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .table .btn-group .btn {
        padding: 0.25rem 0.375rem;
        font-size: 0.75rem;
    }

    /* Hide less important columns */
    .table th:nth-child(3),
    .table td:nth-child(3) {
        display: none;
    }
}

/* Additional Mobile Fixes */
@media (max-width: 767.98px) {

    /* Full Width Modals */
    .modal-dialog.modal-lg {
        max-width: 100%;
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: var(--radius-lg);
    }

    /* Table Horizontal Scroll */
    .table-responsive {
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    /* Better Table Layout - Allow Scroll */
    .table {
        min-width: 600px;
    }

    .table thead {
        display: table-header-group;
    }

    .table tbody tr {
        display: table-row;
        margin-bottom: 0;
        padding: 0;
        background: transparent;
        border: none;
        border-radius: 0;
    }

    .table tbody td {
        display: table-cell;
        border-bottom: 1px solid var(--border-light);
    }

    .table tbody td::before {
        content: none;
    }

    /* Project Cards */
    .card h5.card-title {
        font-size: 1rem;
    }

    .card h5.card-title a {
        word-break: break-word;
    }
}

/* Extra small screens */
@media (max-width: 374.98px) {
    .page-title {
        font-size: 1.25rem;
    }

    .page-subtitle {
        font-size: 0.8rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    .btn i {
        margin-right: 0.25rem !important;
    }

    .card-body {
        padding: 0.75rem;
    }

    .badge {
        font-size: 0.65rem;
    }
}

/* Print Styles */
@media print {

    .sidebar,
    .mobile-toggle,
    .mobile-header,
    .btn {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        padding: 0;
    }

    .invoice-preview {
        box-shadow: none;
        border: none;
    }

    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}