/* GrusCore Med EHR - Main Stylesheet */
/* Theme: Crane & Medical - Navy Blue & Teal */

:root {
    --navy-blue: #1E3A8A;
    --teal: #0D9488;
    --light-teal: #14B8A6;
    --gold: #F59E0B;
    --primary-color: #1E3A8A;
    --secondary-color: #0D9488;
    --success-color: #10B981;
    --info-color: #06B6D4;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --light-color: #F9FAFB;
    --dark-color: #1F2937;
    --white: #FFFFFF;
    --transition-speed: 0.3s;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f6f9;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

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

.footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    margin-top: auto;
}

.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0 1rem rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
}

.btn {
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.alert {
    border: none;
    border-radius: 0.5rem;
}

.table {
    background-color: white;
}

.badge {
    padding: 0.35em 0.65em;
    font-weight: 500;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 86, 179, 0.25);
}

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

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

.jumbotron {
    padding: 2rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 0 1rem rgba(0, 0, 0, 0.05);
}

.sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.1);
}

.sidebar-sticky {
    position: sticky;
    top: 0;
    height: calc(100vh - 48px);
    padding-top: 0.5rem;
    overflow-x: hidden;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .sidebar {
        position: relative;
        top: 0;
    }
}

.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25em solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-page {
    padding: 2rem 0;
}

.custom-file-label::after {
    content: "Browse";
}

.patient-card {
    border-left: 4px solid var(--primary-color);
}

.appointment-card {
    border-left: 4px solid var(--success-color);
}

.record-card {
    border-left: 4px solid var(--info-color);
}

.nav-pills .nav-link.active {
    background-color: var(--primary-color);
}

/* Custom Navy and Teal Styles */
.bg-navy {
    background-color: var(--navy-blue) !important;
}

.bg-teal {
    background-color: var(--teal) !important;
}

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

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

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

.btn-teal:hover {
    background-color: var(--light-teal);
    border-color: var(--light-teal);
    color: white;
}

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

.btn-navy:hover {
    background-color: #1e40af;
    border-color: #1e40af;
    color: white;
}

/* Sticky Header */
.navbar {
    position: sticky !important;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Hero Section Styles */
.hero-section {
    background: linear-gradient(135deg, var(--navy-blue) 0%, var(--teal) 100%);
    color: white;
    padding: 5rem 0;
    border-radius: 0;
    position: relative;
    overflow: hidden;
    margin-bottom: 0 !important;
}

.min-vh-60 {
    min-height: 60vh;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

/* Hero Logo */
.hero-logo-container {
    position: relative;
    padding: 2rem;
}

.hero-logo-icon {
    font-size: 15rem;
    color: rgba(255, 255, 255, 0.15);
    display: block;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.hero-decoration {
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 100px;
    background: white;
    clip-path: polygon(0 50%, 100% 0, 100% 100%, 0% 100%);
}

@media (max-width: 991.98px) {
    .hero-section {
        padding: 4rem 0;
    }
    .hero-logo-icon {
        font-size: 8rem;
    }
}

/* Feature Cards */
.feature-card {
    transition: all 0.3s ease;
    border: 2px solid transparent;
    height: 100%;
}

.feature-card:hover {
    border-color: var(--teal);
    box-shadow: 0 0.5rem 1rem rgba(13, 148, 136, 0.15);
}

.feature-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
}

.feature-icon.navy {
    background-color: rgba(30, 58, 138, 0.1);
    color: var(--navy-blue);
}

.feature-icon.teal {
    background-color: rgba(13, 148, 136, 0.1);
    color: var(--teal);
}

/* About Page Crane Symbolism */
.crane-symbol {
    font-size: 4rem;
    color: var(--teal);
}

.symbolism-card {
    border-left: 4px solid var(--teal);
    background: linear-gradient(to right, rgba(13, 148, 136, 0.05), transparent);
}

/* Footer Links Hover */
footer a:hover {
    color: var(--teal) !important;
    transition: color 0.3s ease;
}

/* Navbar Enhancements */
.navbar-brand:hover {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.nav-link {
    position: relative;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover {
    color: var(--teal) !important;
}

/* Active Navigation State */
.navbar-dark .nav-link.active {
    color: var(--teal) !important;
    font-weight: 600;
}

.navbar-dark .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 3px;
    background: linear-gradient(90deg, var(--teal) 0%, var(--light-teal) 100%);
    border-radius: 2px 2px 0 0;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: calc(100% - 2rem);
        opacity: 1;
    }
}

/* Dropdown Active State */
.navbar-dark .nav-link.dropdown-toggle.active {
    color: var(--teal) !important;
}

/* ===== ADDITIONAL ENHANCEMENTS ===== */

/* Image Preview */
.image-preview-container {
    position: relative;
    display: inline-block;
    margin-top: 1rem;
}

.image-preview {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 3px solid var(--teal);
    transition: transform var(--transition-speed);
}

.image-preview:hover {
    transform: scale(1.05);
}

.remove-image-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-speed);
}

.remove-image-btn:hover {
    background: #DC2626;
    transform: scale(1.1);
}

/* Loading Spinner Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-speed);
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.spinner-crane {
    font-size: 3rem;
    animation: float-spin 2s ease-in-out infinite;
}

@keyframes float-spin {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

/* Form Enhancements */
.form-control:focus,
.form-select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
    transition: all var(--transition-speed);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--success-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2310B981' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
}

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

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

.was-validated .form-control:invalid ~ .invalid-feedback,
.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Button Enhancements */
.btn {
    transition: all var(--transition-speed);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-navy,
.btn-teal {
    position: relative;
    overflow: hidden;
}

.btn-navy::after,
.btn-teal::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn-navy:hover::after,
.btn-teal:hover::after {
    width: 300px;
    height: 300px;
}

/* Card Animations */
.card {
    transition: all var(--transition-speed);
}

.card:hover {
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
}

.card-hover-lift {
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.card-hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.15);
}

/* Alert Enhancements */
.alert {
    border-left: 4px solid;
    animation: slideInRight 0.5s ease-out;
}

.alert-success {
    border-left-color: var(--success-color);
    background-color: rgba(16, 185, 129, 0.1);
}

.alert-danger {
    border-left-color: var(--danger-color);
    background-color: rgba(239, 68, 68, 0.1);
}

.alert-warning {
    border-left-color: var(--warning-color);
    background-color: rgba(245, 158, 11, 0.1);
}

.alert-info {
    border-left-color: var(--info-color);
    background-color: rgba(6, 182, 212, 0.1);
}

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

/* Table Enhancements */
.table {
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

.table tbody tr {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-speed);
}

.table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Badge Enhancements */
.badge {
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all var(--transition-speed);
}

.badge:hover {
    transform: scale(1.05);
}

/* Tooltip Customization */
.tooltip .tooltip-inner {
    background-color: var(--navy-blue);
    color: white;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.tooltip .tooltip-arrow::before {
    border-top-color: var(--navy-blue);
}

/* Focus Indicators for Accessibility */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid var(--teal);
    outline-offset: 2px;
}

/* Skip to Main Content Link */
.skip-to-main {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 1rem;
    background: var(--navy-blue);
    color: white;
    text-decoration: none;
}

.skip-to-main:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 1rem;
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

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

/* Mobile Responsive Enhancements */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 0;
    }

    .display-1 {
        font-size: 3rem;
    }

    .display-2 {
        font-size: 2.5rem;
    }

    .table {
        font-size: 0.875rem;
    }

    .card-body {
        padding: 1rem;
    }

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

    /* Mobile Navigation Enhancements */
    .navbar-collapse {
        background: var(--navy-blue);
        padding: 1rem;
        margin-top: 0.5rem;
        border-radius: 0.5rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    .nav-item {
        margin: 0.25rem 0;
    }

    .nav-link {
        padding: 0.75rem 1rem !important;
        border-radius: 0.375rem;
        display: block;
    }

    .nav-link:hover,
    .nav-link:focus {
        background-color: rgba(13, 148, 136, 0.1);
    }

    .navbar-dark .nav-link.active {
        background-color: rgba(13, 148, 136, 0.2);
        border-left: 3px solid var(--teal);
    }

    .navbar-dark .nav-link.active::after {
        display: none;
    }

    /* Touch-friendly dropdown */
    .dropdown-menu {
        border: none;
        background: rgba(255, 255, 255, 0.1);
        padding: 0.5rem;
    }

    .dropdown-item {
        color: rgba(255, 255, 255, 0.9);
        padding: 0.75rem 1rem;
        border-radius: 0.375rem;
        margin: 0.25rem 0;
    }

    .dropdown-item:hover,
    .dropdown-item:focus {
        background-color: rgba(13, 148, 136, 0.2);
        color: white;
    }

    /* Hamburger menu animation */
    .navbar-toggler {
        border: 2px solid rgba(255, 255, 255, 0.5);
        padding: 0.5rem 0.75rem;
    }

    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.25rem rgba(13, 148, 136, 0.5);
    }

    .navbar-toggler-icon {
        width: 1.5em;
        height: 1.5em;
    }
}

@media (max-width: 576px) {
    .display-1 {
        font-size: 2.5rem;
    }

    .display-2 {
        font-size: 2rem;
    }

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

    .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background: var(--teal);
    color: white;
}

::-moz-selection {
    background: var(--teal);
    color: white;
}

/* Scrollbar Styling (Webkit browsers) */
::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--teal);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--navy-blue);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn-navy,
    .btn-teal {
        border: 2px solid currentColor;
    }

    .card {
        border: 2px solid #000;
    }
}

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