/* ============================================================================
   AU Billing Application - Modern CSS
   ============================================================================ */

/* Root variables for consistent theming */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #16a085;
    --light-bg: #ecf0f1;
    --dark-text: #2c3e50;
    --border-color: #bdc3c7;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============================================================================
   Base & Typography
   ============================================================================ */

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: #f5f7fa;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--dark-text);
    margin-top: 0;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: darken(var(--secondary-color), 10%);
    text-decoration: underline;
}

/* ============================================================================
   Navigation
   ============================================================================ */

nav {
    background: linear-gradient(135deg, var(--primary-color) 0%, #34495e 100%);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 0.5rem;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    transition: var(--transition);
    display: inline-block;
}

nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-2px);
}

/* ============================================================================
   Main Content
   ============================================================================ */

main {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 140px);
}

/* ============================================================================
   Alerts & Messages
   ============================================================================ */

.alert {
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: #d5f4e6;
    color: #1a5f47;
    border-color: var(--success-color);
}

.alert-danger {
    background-color: #fadbd8;
    color: #922b21;
    border-color: var(--danger-color);
}

.alert-warning {
    background-color: #fef5e7;
    color: #7d6608;
    border-color: var(--warning-color);
}

.alert-info {
    background-color: #d6eaf8;
    color: #0c3c75;
    border-color: var(--info-color);
}

/* ============================================================================
   Error Pages
   ============================================================================ */

.error-page {
    text-align: center;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.error-page h1 {
    font-size: 4rem;
    color: var(--danger-color);
    margin-bottom: 1rem;
}

.error-page p {
    font-size: 1.25rem;
    color: #666;
    margin-bottom: 2rem;
}

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

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group.required label::after {
    content: " *";
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background-color: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background-color: #f9fafb;
}

.form-control:disabled {
    background-color: #f5f7fa;
    color: #999;
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.invalid-feedback {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: block;
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232c3e50' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
    display: inline-block;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    white-space: nowrap;
    user-select: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2980b9 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2980b9 0%, #1f618d 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #1e8449 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e8449 0%, #186a3b 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #c0392b 100%);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d68910 100%);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: linear-gradient(135deg, #d68910 0%, #ba4a00 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-outline-secondary:hover:not(:disabled) {
    background-color: var(--secondary-color);
    color: white;
}

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

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

/* ============================================================================
   Authentication Styles
   ============================================================================ */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 100px);
    padding: 2rem;
}

.auth-card {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.auth-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--light-bg);
    color: #666;
    font-size: 0.95rem;
}

.auth-footer a {
    color: var(--secondary-color);
    font-weight: 600;
}

/* ============================================================================
   Profile Styles
   ============================================================================ */

.profile-container {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

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

.profile-card h1 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--secondary-color);
}

.profile-info {
    margin: 2rem 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--light-bg);
    transition: var(--transition);
}

.info-row:hover {
    background-color: #f9fafb;
}

.info-row .label {
    font-weight: 600;
    color: #666;
    width: 40%;
}

.info-row .value {
    color: var(--dark-text);
    font-weight: 500;
    text-align: right;
}

.profile-actions {
    margin-top: 2.5rem;
    display: flex;
    gap: 1rem;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

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

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--light-bg);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: #f9fafb;
}

.table-responsive {
    overflow-x: auto;
}

/* ============================================================================
   Cards & Containers
   ============================================================================ */

.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

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

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

.card-title {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

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

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

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

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 2rem 0;
}

.page-item {
    margin: 0;
}

.page-link {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--secondary-color);
    transition: var(--transition);
}

.page-link:hover {
    background-color: var(--light-bg);
    border-color: var(--secondary-color);
}

.page-item.active .page-link {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* ============================================================================
   Footer
   ============================================================================ */

footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
    font-size: 0.9rem;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

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

.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.75rem;
}

.col-md-2 { flex: 0 0 calc(16.667% - 1.5rem); margin: 0.75rem; }
.col-md-3 { flex: 0 0 calc(25% - 1.5rem); margin: 0.75rem; }
.col-md-4 { flex: 0 0 calc(33.333% - 1.5rem); margin: 0.75rem; }
.col-md-6 { flex: 0 0 calc(50% - 1.5rem); margin: 0.75rem; }
.col-md-8 { flex: 0 0 calc(66.666% - 1.5rem); margin: 0.75rem; }
.col-md-10 { flex: 0 0 calc(83.333% - 1.5rem); margin: 0.75rem; }

.g-3 {
    gap: 1rem;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-end {
    justify-content: flex-end;
}

.align-items-center {
    align-items: center;
}

.gap-2 {
    gap: 1rem;
}

.mt-5 {
    margin-top: 2rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.w-100 {
    width: 100%;
}

/* ============================================================================
   Badges
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

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

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

.bg-warning {
    background-color: var(--warning-color);
    color: white;
}

.bg-info {
    background-color: var(--info-color);
    color: white;
}

.bg-secondary {
    background-color: #95a5a6;
    color: white;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 1rem;
    }

    nav ul {
        flex-direction: column;
        width: 100%;
    }

    .row {
        margin: 0;
    }

    .col-md-2,
    .col-md-3,
    .col-md-4,
    .col-md-6,
    .col-md-8,
    .col-md-10 {
        flex: 0 0 100%;
        margin: 0.75rem 0;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }

    .info-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .info-row .label {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .info-row .value {
        text-align: left;
        width: 100%;
    }

    .profile-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    main {
        padding: 1rem;
        min-height: calc(100vh - 200px);
    }

    .table {
        font-size: 0.9rem;
    }

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