@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --dark: #1f2937;
    --light: #f9fafb;
    --border: #e5e7eb;
    --text: #374151;
    --text-light: #6b7280;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background-color: var(--light);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== NAVBAR (PROFESSIONAL DESIGN) ===== */
.navbar {
    background-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(79, 70, 229, 0.1);
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: all 0.3s;
    flex-shrink: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.navbar-brand:hover {
    opacity: 0.85;
}

.navbar-brand img {
    height: 42px;
    width: auto;
    object-fit: contain;
}

.navbar-brand span {
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

/* Desktop Menu */
.navbar-menu {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
    margin: 0;
    padding: 0;
}

.navbar-menu a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: color 0.2s;
    position: relative;
}

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

.navbar-menu a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: width 0.3s ease;
}

.navbar-menu a:hover::after {
    width: 100%;
}

.navbar-menu form {
    margin: 0;
}

/* Hamburger Toggle (Mobile Only) */
.navbar-toggle {
    display: none;
    background: none;
    border: 2px solid var(--primary);
    border-radius: 6px;
    cursor: pointer;
    padding: 0.5rem;
    position: relative;
    width: 44px;
    height: 44px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.navbar-toggle span {
    display: block;
    width: 22px;
    height: 2.5px;
    background-color: var(--primary);
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* Overlay (not used for regular navbar) */
.navbar-overlay {
    display: none;
}

/* Mobile Dropdown Menu */
@media (max-width: 768px) {
    .navbar-toggle {
        display: flex;
    }

    .navbar-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: white;
        flex-direction: column;
        gap: 0;
        padding: 0;
        margin: 0;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
        border-top: 1px solid var(--border);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .navbar-menu.active {
        max-height: 500px;
    }

    .navbar-menu li {
        width: 100%;
        border-bottom: 1px solid var(--border);
    }

    .navbar-menu li:last-child {
        border-bottom: none;
    }

    .navbar-menu a,
    .navbar-menu .btn {
        display: block;
        width: 100%;
        text-align: left;
        padding: 1rem 1.5rem;
        margin: 0;
        border-radius: 0;
        border: none;
        background: none;
        color: var(--text);
        font-weight: 500;
        transition: all 0.2s;
    }

    .navbar-menu a::after {
        display: none;
    }

    .navbar-menu a:hover,
    .navbar-menu .btn:hover {
        background-color: var(--light);
        color: var(--primary);
    }

    .navbar-menu form {
        width: 100%;
        margin: 0;
    }

    .navbar-menu form button {
        width: 100%;
        text-align: left;
        justify-content: flex-start;
        background: none;
        color: var(--danger);
        border: none;
        font-weight: 500;
        padding: 1rem 1.5rem;
    }

    .navbar-menu form button:hover {
        background-color: rgba(239, 68, 68, 0.1);
        color: var(--danger-dark);
    }

    /* Hamburger Animation */
    .navbar-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .navbar-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .navbar-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    .navbar {
        position: relative;
    }
}

/* ===== BUTTONS (UNIFIED) ===== */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
}

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

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: var(--secondary-dark);
    border-color: var(--secondary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

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

.btn-danger:hover:not(:disabled) {
    background-color: var(--danger-dark);
    border-color: var(--danger-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

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

.btn-outline:hover:not(:disabled) {
    background-color: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
}

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

/* ===== HERO ===== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

/* ===== PRICING ===== */
.pricing {
    padding: 4rem 0;
}

.pricing h2 {
    text-align: center;
    font-size: 2.25rem;
    margin-bottom: 3rem;
    font-weight: 700;
}

.pricing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.pricing-card {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.pricing-card.featured {
    border: 3px solid var(--primary);
}

.pricing-card .badge {
    background-color: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    display: inline-block;
    margin-bottom: 1rem;
    font-weight: 600;
}

.pricing-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.pricing-card .price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1rem 0;
}

.pricing-card .price span {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 400;
}

.pricing-card ul {
    list-style: none;
    margin: 1.5rem 0;
}

.pricing-card li {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pricing-card li:before {
    content: "✓";
    color: var(--secondary);
    font-weight: bold;
}

/* ===== DASHBOARD ===== */
.dashboard {
    padding: 2rem 0;
}

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

.dashboard-header h1 {
    font-size: 1.875rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.stat-card .value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--dark);
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    flex-wrap: wrap;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

/* ===== TABLES ===== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background-color: var(--light);
}

.table th,
.table td {
    padding: 0.875rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

.table th {
    font-weight: 600;
    color: var(--text);
}

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

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--secondary);
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

/* ===== AUTH PAGES ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

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

.auth-card h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
    font-weight: 700;
    font-size: 1.75rem;
}

.auth-card .logo-container {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-card .logo-container img {
    max-height: 80px;
    width: auto;
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar-content {
        flex-direction: column;
        padding: 1rem 0;
        gap: 0.75rem;
    }

    .navbar-brand img {
        height: 35px;
    }

    .navbar-menu {
        width: 100%;
        justify-content: center;
        gap: 0.75rem;
        font-size: 0.875rem;
        flex-wrap: wrap;
    }

    .navbar-menu li {
        flex-shrink: 0;
    }

    .hero {
        padding: 3rem 0;
    }

    .hero h1 {
        font-size: 1.875rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .pricing-cards {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-header .btn {
        width: 100%;
        margin-bottom: 0;
    }

    .card {
        padding: 1rem;
    }

    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.625rem 0.5rem;
    }

    .auth-card {
        padding: 2rem 1.5rem;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    /* Make form buttons stack properly on mobile */
    form .btn {
        width: 100%;
    }

    /* Keep inline buttons (like in tables) smaller */
    .table .btn,
    .btn-sm {
        width: auto;
        display: inline-block;
        padding: 0.25rem 0.625rem;
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .navbar-brand {
        font-size: 1.25rem;
    }

    .navbar-brand img {
        height: 30px;
    }

    .navbar-menu {
        gap: 0.5rem;
        font-size: 0.8125rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    form .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    .pricing-card {
        padding: 1.5rem;
    }

    .stat-card {
        padding: 1rem;
    }

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

    .card-header h2 {
        font-size: 1.125rem;
    }

    /* Ensure table action buttons don't wrap awkwardly */
    .table td form {
        display: inline-block;
        margin: 0;
    }
}

/* ===== INVOICE VIEW SPECIFIC ===== */
.invoice-view {
    background: white;
    padding: 2.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    gap: 1rem;
    flex-wrap: wrap;
}

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

@media print {
    .navbar, .no-print {
        display: none !important;
    }
    .invoice-view {
        box-shadow: none;
        padding: 0;
    }
    body {
        background: white;
    }
}

/* ===== COMPREHENSIVE MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {
    /* Invoice specific */
    .invoice-header {
        flex-direction: column;
    }

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

    .invoice-view {
        padding: 1.5rem;
    }

    /* Container adjustments */
    .container {
        padding: 0 1rem;
    }

    /* Hero section */
    .hero h1 {
        font-size: 1.875rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero {
        padding: 3rem 0;
    }

    /* Pricing cards */
    .pricing-cards {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .pricing h2 {
        font-size: 1.875rem;
    }

    /* Dashboard */
    .dashboard-header h1 {
        font-size: 1.75rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Card headers */
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

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

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

    table {
        font-size: 0.875rem;
    }

    /* Form grids */
    .invoice-form-grid {
        grid-template-columns: 1fr !important;
    }

    /* Action buttons */
    .actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .actions .btn {
        width: 100%;
    }

    /* Modals */
    .modal-content {
        margin: 1rem;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .pricing-cards {
        grid-template-columns: repeat(2, 1fr);
    }

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

/* Large screens */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}
