/* =============================================
   Pets and Friends Portal - Global Stylesheet
   Brand Colours:
     Primary:   #549BAD (teal)
     Secondary: #83BDC0 (light teal)
     Dark Text: #333333
     Light BG:  #f8f9fa
   ============================================= */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    color: #333333;
    background-color: #f8f9fa;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #549BAD;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #3d7a8a;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Header --- */
.main-header {
    background-color: #ffffff;
    border-bottom: 3px solid #549BAD;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 64px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.4rem;
    font-weight: bold;
    color: #549BAD;
    text-decoration: none;
    white-space: nowrap;
}

.logo:hover {
    color: #3d7a8a;
}

.logo-icon {
    font-size: 1.6rem;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #549BAD;
    cursor: pointer;
    padding: 8px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #555;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    background-color: #e8f4f6;
    color: #549BAD;
}

.nav-link.active {
    background-color: #549BAD;
    color: #ffffff;
}

.nav-link i {
    font-size: 0.9rem;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.user-greeting {
    font-size: 0.875rem;
    color: #666;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    padding: 30px 0;
}

/* --- Footer --- */
.main-footer {
    background-color: #549BAD;
    color: #ffffff;
    padding: 20px 0;
    text-align: center;
    font-size: 0.85rem;
    margin-top: auto;
}

.main-footer a {
    color: #ffffff;
    text-decoration: underline;
}

.main-footer a:hover {
    color: #e0e0e0;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background-color: #549BAD;
    color: #ffffff;
    border-color: #549BAD;
}

.btn-primary:hover {
    background-color: #3d7a8a;
    border-color: #3d7a8a;
    color: #ffffff;
}

.btn-secondary {
    background-color: #83BDC0;
    color: #ffffff;
    border-color: #83BDC0;
}

.btn-secondary:hover {
    background-color: #6ba9ac;
    border-color: #6ba9ac;
    color: #ffffff;
}

.btn-outline {
    background-color: transparent;
    color: #549BAD;
    border-color: #549BAD;
}

.btn-outline:hover {
    background-color: #549BAD;
    color: #ffffff;
}

.btn-danger {
    background-color: #dc3545;
    color: #ffffff;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #b02a37;
    border-color: #b02a37;
    color: #ffffff;
}

.btn-success {
    background-color: #28a745;
    color: #ffffff;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #1e7e34;
    border-color: #1e7e34;
    color: #ffffff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

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

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Cards --- */
.card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    background-color: #549BAD;
    color: #ffffff;
    padding: 16px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header-light {
    background-color: #e8f4f6;
    color: #549BAD;
    padding: 16px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 1px solid #d0e8ec;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    color: #333;
}

.form-label .required {
    color: #dc3545;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    background-color: #ffffff;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-control:focus {
    border-color: #549BAD;
    box-shadow: 0 0 0 3px rgba(84, 155, 173, 0.15);
    outline: none;
}

.form-control::placeholder {
    color: #aaa;
}

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

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='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #549BAD;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-help {
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
}

.form-error {
    font-size: 0.8rem;
    color: #dc3545;
    margin-top: 4px;
}

/* Toggle field (for yes/no conditional text areas) */
.toggle-field {
    margin-top: 8px;
    padding-left: 26px;
}

.toggle-field.hidden {
    display: none;
}

/* --- Alerts --- */
.alert {
    padding: 14px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
    position: relative;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background-color: #e8f4f6;
    color: #3d7a8a;
    border: 1px solid #b8dce2;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    position: absolute;
    top: 10px;
    right: 14px;
    line-height: 1;
}

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

.banner-alert {
    border-left: 4px solid #ffc107;
}

.banner-alert a {
    color: #856404;
    font-weight: 600;
    text-decoration: underline;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-info {
    background-color: #e8f4f6;
    color: #3d7a8a;
}

.badge-default {
    background-color: #e9ecef;
    color: #666;
}

/* --- Tables --- */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #549BAD;
    white-space: nowrap;
}

.data-table tr:hover {
    background-color: #f0f8fa;
}

.data-table .actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

/* --- Page Headers --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.6rem;
    color: #549BAD;
    font-weight: 700;
}

.page-header h2 {
    font-size: 1.3rem;
    color: #549BAD;
}

/* --- Grid --- */
.grid {
    display: grid;
    gap: 20px;
}

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

/* --- Stat Cards (Dashboard) --- */
.stat-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background-color: #e8f4f6;
    color: #549BAD;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.stat-info p {
    font-size: 0.85rem;
    color: #888;
    margin-top: 4px;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.page-link {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #549BAD;
    transition: all 0.2s;
}

.page-link:hover,
.page-link.active {
    background-color: #549BAD;
    color: #ffffff;
    border-color: #549BAD;
}

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background-color: #ffffff;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 1.1rem;
    color: #549BAD;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #888;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* --- Auth Pages --- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #549BAD 0%, #83BDC0 100%);
    padding: 20px;
}

.auth-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 460px;
    padding: 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo i {
    font-size: 3rem;
    color: #549BAD;
}

.auth-logo h1 {
    font-size: 1.6rem;
    color: #549BAD;
    margin-top: 8px;
}

.auth-logo p {
    font-size: 0.9rem;
    color: #888;
    margin-top: 4px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.85rem;
    color: #888;
}

.auth-footer a {
    font-weight: 600;
}

/* Role selector on register page */
.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.role-option {
    padding: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.role-option:hover {
    border-color: #549BAD;
    background-color: #f0f8fa;
}

.role-option.selected {
    border-color: #549BAD;
    background-color: #e8f4f6;
}

.role-option i {
    font-size: 2rem;
    color: #549BAD;
    display: block;
    margin-bottom: 8px;
}

.role-option span {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

.role-option input[type="radio"] {
    display: none;
}

/* --- Pet Cards --- */
.pet-card {
    border: 2px solid #e8f4f6;
    border-radius: 8px;
    padding: 20px;
    position: relative;
}

.pet-card h3 {
    color: #549BAD;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pet-detail {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.875rem;
}

.pet-detail strong {
    min-width: 120px;
    color: #666;
}

/* --- Calendar --- */
.fc {
    background: #ffffff;
    border-radius: 8px;
    padding: 10px;
}

.fc .fc-button-primary {
    background-color: #549BAD;
    border-color: #549BAD;
}

.fc .fc-button-primary:hover {
    background-color: #3d7a8a;
}

.fc .fc-button-primary:not(:disabled).fc-button-active {
    background-color: #3d7a8a;
}

.fc .fc-daygrid-day.fc-day-today {
    background-color: #e8f4f6;
}

/* --- Invoice Template --- */
.invoice {
    background: #ffffff;
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #549BAD;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.invoice-table th {
    background-color: #549BAD;
    color: #ffffff;
    padding: 10px 12px;
    text-align: left;
}

.invoice-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.invoice-total {
    text-align: right;
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 16px;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-state i {
    font-size: 4rem;
    color: #83BDC0;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #888; }
.text-small { font-size: 0.85rem; }
.text-primary { color: #549BAD; }
.text-danger { color: #dc3545; }
.text-success { color: #28a745; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        padding: 10px 0;
    }

    .main-nav.open {
        display: flex;
    }

    .nav-link {
        padding: 10px 16px;
    }

    .header-container {
        flex-wrap: wrap;
    }

    .header-user {
        width: 100%;
        justify-content: space-between;
        padding: 10px 0;
        border-top: 1px solid #eee;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

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

    .auth-card {
        padding: 24px;
    }

    .role-selector {
        grid-template-columns: 1fr;
    }
}

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

    .card-body {
        padding: 16px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}
