/* Pet Manager - Custom Styles */
/* Clean & Modern Enterprise Theme */

:root {
    --primary-color: #3949AB;
    --primary-dark: #303F9F;
    --primary-light: #5C6BC0;
    --secondary-color: #455A64;
    --secondary-dark: #37474F;
    --accent-color: #26A69A;
    --accent-dark: #00897B;
    --success-color: #26A69A;
    --danger-color: #E53935;
    --warning-color: #FB8C00;
    --info-color: #E1F5FE;
    --dark-color: #455A64;
    --light-color: #FAFBFF;
    --text-dark: #263238;
    --text-muted: #607D8B;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light-color);
    color: var(--text-dark);
    min-height: 100vh;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 50%, var(--accent-color) 100%);
    min-height: 100vh;
}

.login-page .card {
    border: none;
    border-radius: 1rem;
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.navbar.bg-primary {
    background-color: var(--primary-color) !important;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
    color: #fff !important;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link.active {
    color: #fff;
}

.navbar-dark .navbar-toggler-icon {
    filter: brightness(1);
}

.navbar .text-white {
    color: #fff !important;
}

.navbar .btn-outline-light {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

.navbar .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: #fff;
}

/* Custom Button Styles */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-success {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.btn-success:hover,
.btn-success:focus {
    background-color: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-outline-success {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-outline-success:hover {
    background-color: var(--accent-color);
    color: #fff;
}

/* Statistics Cards */
.stat-card {
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.stat-icon.text-primary {
    color: var(--primary-color) !important;
}

.stat-icon.text-success {
    color: var(--accent-color) !important;
}

/* Dog Cards */
.dog-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.dog-card.male {
    border: 2px solid var(--primary-color);
    background: rgba(57, 73, 171, 0.05);
}

.dog-card.female {
    border: 2px solid #E91E63;
    background: rgba(233, 30, 99, 0.05);
}

.dog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,.2);
}

.dog-card .card-img-top {
    height: 250px;
    object-fit: cover;
    background-color: #f8f9fa;
}

.dog-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Breeding Cards */
.breeding-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.breeding-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,.2);
}

/* Litter Cards */
.litter-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.litter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,.2);
}

/* Puppy Cards */
.puppy-card {
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
}

.puppy-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

/* Filter Bar */
.filter-bar {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,.05);
    margin-bottom: 1.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

/* Photo Gallery */
.photo-preview {
    position: relative;
    width: 120px;
    height: 120px;
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
    display: inline-block;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview.primary-photo {
    border-color: var(--accent-color);
    border-width: 3px;
}

.photo-preview .remove-photo {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
}

.photo-preview .set-primary-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(38, 166, 154, 0.9);
    color: white;
    border: none;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
}

.photo-preview .primary-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: var(--accent-color);
    color: white;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Photo Thumbnails in Dog Detail Modal */
.photo-thumbnail {
    width: 100%;
    padding-bottom: 100%; /* 1:1 aspect ratio */
    background-size: cover;
    background-position: center;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    border: 2px solid #dee2e6;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.photo-thumbnail:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.photo-thumbnail .photo-actions {
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.photo-thumbnail:hover .photo-actions {
    opacity: 1;
}

.photo-thumbnail .photo-actions .btn {
    padding: 0.15rem 0.35rem;
    font-size: 0.7rem;
}

/* Modal Improvements */
.modal-header {
    background: var(--primary-color);
    color: #fff;
}

.modal-header .modal-title {
    color: #fff;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Tabs */
.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-bottom: 3px solid transparent;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: transparent;
    font-weight: 600;
}

/* Nav Pills (Dog Detail Tabs) */
.nav-pills .nav-link {
    color: var(--text-muted);
    background-color: transparent;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.nav-pills .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(57, 73, 171, 0.05);
    border-color: var(--primary-color);
}

.nav-pills .nav-link.active {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.nav-pills.nav-fill .nav-link {
    margin: 0 0.15rem;
}

/* Timeline (for history) */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
    border-left: 2px solid #dee2e6;
    padding-left: 1.5rem;
    margin-left: 0.5rem;
}

.timeline-item:last-child {
    border-left: none;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -0.5rem;
    top: 0;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--accent-color);
    border: 3px solid white;
    box-shadow: 0 0 0 2px var(--accent-color);
}

/* Footer */
.app-footer {
    background: white;
    border-top: 1px solid #dee2e6;
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer-logo {
    height: 40px;
}

.footer-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.footer-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Loading spinner */
.spinner-border.text-primary {
    color: var(--primary-color) !important;
}

/* Status Badges */
.badge-active-breeding {
    background-color: var(--accent-color);
    color: #fff;
}

.badge-puppy {
    background-color: #29B6F6;
}

.badge-retired {
    background-color: var(--secondary-color);
}

.badge-sold {
    background-color: var(--primary-color);
    color: #fff;
}

.badge-external-stud {
    background-color: var(--secondary-dark);
}

/* Bootstrap badge overrides */
.bg-success {
    background-color: var(--accent-color) !important;
    color: #fff !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
    color: #fff !important;
}

.bg-info {
    background-color: var(--info-color) !important;
    color: var(--text-dark) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dog-card .card-img-top {
        height: 200px;
    }

    .stat-card {
        margin-bottom: 1rem;
    }

    .filter-bar .col-md-2,
    .filter-bar .col-md-4 {
        margin-bottom: 0.5rem;
    }
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
}

/* Print styles */
@media print {
    .navbar,
    .filter-bar,
    .btn,
    .modal,
    .app-footer {
        display: none !important;
    }
}

/* Dog Detail Photo */
.dog-detail-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 4px solid var(--accent-color);
}

/* Toast styling */
.toast-container .toast {
    min-width: 300px;
}

.toast-header.bg-success .btn-close,
.toast-header.bg-danger .btn-close,
.toast-header.bg-info .btn-close {
    filter: brightness(0) invert(1);
}

/* Mobile button sizing */
@media (max-width: 575.98px) {
    .w-sm-auto {
        width: 100% !important;
    }

    .modal-footer.flex-column .btn {
        margin-bottom: 0.5rem;
    }

    .modal-footer.flex-column .btn:last-child {
        margin-bottom: 0;
    }
}

@media (min-width: 576px) {
    .w-sm-auto {
        width: auto !important;
    }

    .modal-footer.flex-sm-row {
        flex-direction: row !important;
    }
}

/* Utility classes */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Spin animation for refresh button */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Breeding card layout */
.breeding-pair {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
}

.breeding-pair .name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Analytics Charts */
.card canvas {
    max-height: 200px;
}

/* Pedigree Tree Styles */
.pedigree-container {
    overflow-x: auto;
    padding: 1rem 0;
}

.pedigree-tree {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 600px;
}

.pedigree-tree-horizontal {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5rem;
    min-width: 900px;
}

.pedigree-column {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 180px;
}

.pedigree-connector-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-left: 1.25rem;
}

.pedigree-connector-group::before {
    content: '';
    position: absolute;
    left: 0.25rem;
    top: 0.6rem;
    bottom: 0.6rem;
    width: 2px;
    background: #cbd3df;
    border-radius: 2px;
}

.pedigree-connector-group > .pedigree-node::before {
    content: '';
    position: absolute;
    left: -1.25rem;
    top: 50%;
    width: 1.1rem;
    height: 2px;
    background: #cbd3df;
}

.pedigree-connector-group > .pedigree-node {
    position: relative;
}

.pedigree-connector-group > .pedigree-node:hover::before {
    background: var(--primary-color);
}

.pedigree-connector-group:hover::before {
    background: var(--primary-color);
}

.pedigree-column.gen3 {
    min-width: 160px;
}

.pedigree-column.gen4 {
    min-width: 140px;
}

.pedigree-column.gen5 {
    min-width: 130px;
}

.pedigree-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.pedigree-subject {
    margin-bottom: 0.5rem;
}

.pedigree-parents {
    gap: 2rem;
}

.pedigree-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    max-width: 50%;
}

.pedigree-grandparents {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.pedigree-generation {
    justify-content: flex-start;
}

.pedigree-gen-label {
    min-width: 60px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 0.35rem;
}

.pedigree-gen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.5rem;
    width: 100%;
}

.pedigree-node {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 160px;
}

.pedigree-node:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    transform: translateY(-2px);
}

.pedigree-node:hover,
.pedigree-connector-group:hover > .pedigree-node {
    border-color: var(--primary-color);
}

.pedigree-node.male {
    border-color: var(--primary-color);
    background: rgba(57, 73, 171, 0.05);
}

.pedigree-node.female {
    border-color: #E91E63;
    background: rgba(233, 30, 99, 0.05);
}

.pedigree-node.unknown {
    border-color: #ccc;
    background: #f8f9fa;
    cursor: default;
}

.pedigree-node.unknown:hover {
    box-shadow: none;
    transform: none;
}

.pedigree-node-subject {
    border-width: 3px;
    padding: 1rem;
}

.pedigree-node.small {
    min-width: auto;
    flex: 1;
    padding: 0.5rem;
    flex-direction: column;
    text-align: center;
}

.pedigree-node.small .pedigree-info {
    text-align: center;
}

.pedigree-node.small strong {
    font-size: 0.85rem;
}

.pedigree-node.tiny {
    min-width: auto;
    padding: 0.35rem 0.45rem;
    flex-direction: column;
    text-align: center;
}

.pedigree-node.tiny .pedigree-info {
    text-align: center;
}

.pedigree-node.tiny strong {
    font-size: 0.75rem;
}

.pedigree-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.pedigree-node-subject .pedigree-photo {
    width: 60px;
    height: 60px;
}

.pedigree-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pedigree-photo-placeholder {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pedigree-photo-placeholder i {
    font-size: 1.5rem;
    color: #999;
}

.pedigree-node.male .pedigree-photo-placeholder i {
    color: var(--primary-color);
}

.pedigree-node.female .pedigree-photo-placeholder i {
    color: #E91E63;
}

.pedigree-info {
    overflow: hidden;
    flex: 1;
}

.pedigree-info strong {
    display: block;
    font-size: 0.95rem;
}

.pedigree-info small {
    display: block;
    max-width: 150px;
}

.pedigree-great {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #dee2e6;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pedigree-gen4 {
    font-size: 0.7rem;
    padding-left: 0.25rem;
    border-left: 2px solid var(--primary-light);
}

.pedigree-gen4 small {
    opacity: 0.85;
}

/* Responsive Pedigree */
@media (max-width: 768px) {
    .pedigree-tree {
        min-width: 500px;
    }

    .pedigree-node {
        min-width: 130px;
        padding: 0.5rem;
    }

    .pedigree-photo {
        width: 40px;
        height: 40px;
    }

    .pedigree-node-subject .pedigree-photo {
        width: 50px;
        height: 50px;
    }

    .pedigree-info strong {
        font-size: 0.85rem;
    }
}
