/* CSS Variables for Color Palette */
:root {
    --primary-color: #05386B;
    --secondary-color: #379683;
    --accent-color: #5CDB95;
    --light-accent: #8EE4AF;
    --lightest: #EDF5E1;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --white: #ffffff;
    --danger: #dc3545;
    --warning: #ffc107;
    --success: #28a745;
    --info: #17a2b8;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --gradient-secondary: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    --gradient-light: linear-gradient(135deg, var(--light-accent), var(--lightest));
    
    /* Spacing */
    --header-height: 70px;
    --footer-height: 60px;
    
    /* Shadows */
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --primary-color: #0a4d7a;
    --secondary-color: #4aa693;
    --accent-color: #6ce5a5;
    --light-accent: #9ee8bf;
    --lightest: #1a1a1a;
    --text-dark: #e9ecef;
    --text-light: #adb5bd;
    --white: #212529;
    --gradient-primary: linear-gradient(135deg, #0a4d7a, #4aa693);
    --gradient-secondary: linear-gradient(135deg, #4aa693, #6ce5a5);
    --gradient-light: linear-gradient(135deg, #2c2c2c, #1a1a1a);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--lightest);
    color: var(--text-dark);
    line-height: 1.6;
    padding-top: var(--header-height);
    transition: all 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.section-title {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

/* Header Styles */
.navbar {
    background: var(--gradient-primary) !important;
    height: var(--header-height);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.gradient-header {
    background: var(--gradient-primary);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    padding: 2rem 0;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Card Styles */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    background: var(--white);
    overflow: hidden;
}

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

.card-header {
    background: var(--gradient-light);
    border-bottom: none;
    font-weight: 600;
    color: var(--text-dark);
}

/* Stat Cards */
.stat-card {
    background: var(--gradient-light);
    border: none;
    transition: all 0.3s ease;
}

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

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.5rem;
}

/* Pet Cards */
.pet-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.pet-card:hover {
    transform: scale(1.02);
}

.pet-photo {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px 10px 0 0;
}

.pet-card-body {
    padding: 1.5rem;
}

.pet-status {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-up-to-date {
    background: var(--success);
    color: var(--white);
}

.status-pending {
    background: var(--warning);
    color: var(--text-dark);
}

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

/* Buttons */
.btn {
    border-radius: 10px;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    border: none;
}

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

.btn-primary:hover {
    background: var(--gradient-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

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

/* Forms */
.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    background: var(--white);
    color: var(--text-dark);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(92, 219, 149, 0.25);
    background: var(--white);
}

.form-label {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

/* Modal Styles */
.modal-content {
    border-radius: 15px;
    border: none;
    overflow: hidden;
    background: var(--white);
}

.modal-header {
    border-bottom: none;
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: none;
    padding: 1.5rem;
}

/* Offcanvas Styles */
.offcanvas {
    background: var(--white);
    border: none;
}

.offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.offcanvas-body {
    padding: 1.5rem;
}

/* Menu Items */
.menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: var(--text-dark);
    transition: all 0.3s ease;
    font-weight: 500;
}

.menu-item:hover {
    background: var(--gradient-light);
    color: var(--text-dark);
    transform: translateX(5px);
}

.menu-item.active {
    background: var(--gradient-primary);
    color: var(--white);
}

.menu-item i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

/* Calendar Styles */
.calendar-container {
    background: var(--white);
    border-radius: 15px;
    overflow: hidden;
}

.calendar-header {
    background: var(--gradient-primary);
    color: var(--white);
    padding: 1rem;
    display: flex;
    justify-content: between;
    align-items: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e9ecef;
}

.calendar-day {
    background: var(--white);
    padding: 1rem;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    position: relative;
    transition: all 0.3s ease;
}

.calendar-day:hover {
    background: var(--lightest);
}

.calendar-day.other-month {
    color: var(--text-light);
    background: #f8f9fa;
}

.calendar-day.today {
    background: var(--gradient-light);
    font-weight: 600;
}

.calendar-event {
    background: var(--gradient-secondary);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 5px;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    width: 100%;
    text-align: center;
}

.calendar-event.vaccine {
    background: var(--info);
}

.calendar-event.treatment {
    background: var(--warning);
    color: var(--text-dark);
}

.calendar-event.overdue {
    background: var(--danger);
}

/* Toast Styles */
.toast {
    background: var(--white);
    border: none;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
}

.toast-header {
    background: var(--gradient-light);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
}

/* Activity List */
.activity-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.activity-item:hover {
    background: var(--lightest);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    margin-right: 1rem;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-dark);
}

.activity-description {
    color: var(--text-light);
    font-size: 0.875rem;
}

.activity-time {
    color: var(--text-light);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Photo Preview */
.photo-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    object-fit: cover;
}

/* Footer */
.footer {
    background: var(--gradient-primary);
    color: var(--white);
    padding: 1rem 0;
    margin-top: auto;
    text-align: center;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .stat-card .card-body {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .pet-photo {
        height: 150px;
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 0.5rem;
    }
    
    .calendar-event {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .modal-dialog {
        margin: 1rem;
    }
    
    .offcanvas {
        width: 280px !important;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    .calendar-grid {
        font-size: 0.875rem;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 0.25rem;
    }
    
    .activity-item {
        padding: 0.75rem;
    }
    
    .activity-icon {
        width: 35px;
        height: 35px;
        margin-right: 0.75rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .offcanvas,
    .modal,
    .toast-container,
    .btn,
    .footer {
        display: none !important;
    }
    
    .main-content {
        padding-top: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles */
.btn:focus,
.form-control:focus,
.form-select:focus,
.menu-item:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
        --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.5);
    }
    
    .card {
        border: 2px solid var(--text-dark);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--lightest);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-secondary);
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.slide-in-right {
    animation: slideInRight 0.5s ease-in-out;
}

.slide-in-left {
    animation: slideInLeft 0.5s ease-in-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Utility Classes */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: var(--gradient-primary);
}

.bg-gradient-secondary {
    background: var(--gradient-secondary);
}

.bg-gradient-light {
    background: var(--gradient-light);
}

.border-gradient {
    border: 2px solid transparent;
    background: linear-gradient(var(--white), var(--white)) padding-box,
                var(--gradient-primary) border-box;
}

/* Custom Components */
.progress-ring {
    width: 60px;
    height: 60px;
    transform: rotate(-90deg);
}

.progress-ring-circle {
    fill: none;
    stroke: var(--accent-color);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 157;
    stroke-dashoffset: 157;
    transition: stroke-dashoffset 0.5s ease;
}

.badge-custom {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.badge-warning {
    background: var(--warning);
    color: var(--text-dark);
}

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

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

/* Clinic Card Styles */
.clinic-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

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

.clinic-rating {
    color: #ffc107;
}

.clinic-distance {
    color: var(--text-light);
    font-size: 0.875rem;
}

.clinic-status {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.clinic-status.open {
    color: var(--success);
}

.clinic-status.closed {
    color: var(--danger);
}

/* Vaccination History Styles */
.vaccination-timeline {
    position: relative;
    padding-left: 2rem;
}

.vaccination-timeline::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gradient-primary);
}

.vaccination-item {
    position: relative;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.vaccination-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 1rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 3px solid var(--white);
    box-shadow: 0 0 0 2px var(--accent-color);
}

.vaccination-date {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.vaccination-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.vaccination-details {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Error States */
.error-message {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--success);
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h5 {
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* Language Selector */
.language-flag {
    width: 20px;
    height: 15px;
    margin-right: 0.5rem;
    border-radius: 2px;
}

/* Notification Dot */
.notification-dot {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--white);
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Responsive Tables */
.table-responsive {
    border-radius: 10px;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table th {
    background: var(--gradient-light);
    border: none;
    font-weight: 600;
    color: var(--text-dark);
}

.table td {
    border-color: #e9ecef;
    vertical-align: middle;
}

.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(92, 219, 149, 0.05);
}

/* Custom Switch */
.form-switch .form-check-input {
    background-color: #dee2e6;
    border: none;
    width: 3rem;
    height: 1.5rem;
}

.form-switch .form-check-input:checked {
    background: var(--gradient-primary);
}

.form-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(92, 219, 149, 0.25);
}
