/* ============================================================
   Admin Layout — Shared styles for all admin pages
   
   Sections:
   1. DataTables pagination
   2. Sidebar + main area layout
   3. Role badges
   4. Cards & tables
   5. Modal & form polish
   6. Table action buttons
   7. DataTables search field
   8. Profile dropdown
   9. Responsive sidebar
   10. Stat cards & quick actions (dashboard)
   11. Alert positioning
   12. Form page base styles (dogs/owners)
   13. Compact workspace overrides (dogs/owners)
   ============================================================ */

/* --- DataTables pagination --- */
.dataTables_wrapper .pagination li {
    border: none !important;
    background-color: transparent !important;
}

.dataTables_wrapper .pagination li a {
    background-color: white !important;
    color: #0d6efd !important;
    border: 1px solid #dee2e6 !important;
}

.dataTables_wrapper .pagination li a:hover {
    background-color: #e9ecef !important;
    color: #0d6efd !important;
}

.dataTables_wrapper .pagination li.active a {
    background-color: #0d6efd !important;
    color: white !important;
    border-color: #0d6efd !important;
}

/* ============================================================
   Admin layout system
   ============================================================ */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.admin-sidebar {
    width: 250px;
    background: linear-gradient(180deg, #2c5f2d 0%, #1a3d1e 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1040;
    transition: transform 0.3s ease;
}

.admin-sidebar .sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-sidebar .sidebar-nav { padding: 0.5rem 0; }

.admin-sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 0.75rem 1.5rem;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: white;
    background: rgba(255,255,255,0.1);
    border-left-color: #97bc62;
}

.admin-sidebar .nav-link i { width: 20px; }

/* --- Main area --- */
.admin-main {
    flex: 1;
    margin-left: 250px;
    background: #f8f9fa;
    min-height: 100vh;
}

.admin-header {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

/* ============================================================
   Role badges
   ============================================================ */
.role-admin  { background-color: #dc3545; color: white; }
.role-manager { background-color: #ffc107; color: #212529; }
.role-editor  { background-color: #0d6efd; color: white; }

/* ============================================================
   Cards & tables
   ============================================================ */
.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border-radius: 8px;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.admin-main .card {
    transition: none;
}

.admin-main .card:hover {
    transform: none !important;
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
}

.card-header {
    background: white;
    border-bottom: 1px solid #e9ecef;
}

.card-header .btn-outline-secondary {
    border-color: #6c757d;
}

/* ============================================================
   Modal & form polish
   ============================================================ */
.modal-body .form-control,
.modal-body .form-select {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.925rem;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.modal-body .form-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.modal-body .form-text {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Account status toggle — compact with clear borders */
.modal-body .btn-group {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    overflow: hidden;
}

.modal-body .btn-group .btn {
    font-size: 0.875rem;
    padding: 0.45rem 1rem;
    font-weight: 500;
    border-width: 0;
    border-radius: 0 !important;
}

.modal-body .btn-group .btn + .btn {
    border-left: 1px solid #ced4da;
}

.modal-body .btn-group .btn-check:checked + .btn-outline-success {
    border-color: transparent;
}

.modal-body .btn-group .btn-check:checked + .btn-outline-secondary {
    border-color: transparent;
}

/* Input group eye button alignment */
.modal-body .input-group .btn-outline-secondary {
    border-color: #ced4da;
}

/* ============================================================
   Table action buttons
   ============================================================ */
.table .btn-sm {
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border-radius: 0.5rem;
    border-width: 2px;
}

.table .btn-sm.btn-outline-danger:disabled {
    border-color: #dc3545;
    color: #dc3545;
    opacity: 0.45;
}

/* ============================================================
   DataTables search field styling
   ============================================================ */
.dt-container .dt-search {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.6rem;
    margin: 0 6px 8px 0;
}

.dt-container .dt-search label {
    font-weight: 600;
    color: #111;
    font-size: 0.95rem;
    margin: 0;
}

.dt-container .dt-search input {
    border: 1.5px solid #343a40;
    padding: 0.4rem 0.65rem;
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: 0 0.1rem 0.2rem rgba(0,0,0,0.1);
    border-radius: 0.35rem;
    background-color: #ffffff;
    min-width: 190px;
}

.dt-container .dt-search input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    outline: none;
}

/* ============================================================
   Profile dropdown
   ============================================================ */
.dropdown-menu-end { min-width: 180px; }

/* ============================================================
   Responsive sidebar
   ============================================================ */
@media (max-width: 767.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.show {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
    }
    /* Backdrop when sidebar is open */
    .admin-sidebar.show ~ .admin-main::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1030;
    }
}

/* ============================================================
   Stat cards (dashboard)
   ============================================================ */
.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.stat-card .stat-icon { font-size: 2.5rem; opacity: 0.8; }
.stat-card .stat-number { font-size: 2rem; font-weight: 700; margin: 0.5rem 0; }
.stat-card .stat-label { color: #6c757d; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; }

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}
.quick-action-btn {
    padding: 1.5rem; text-align: center; background: white;
    border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease; text-decoration: none; color: inherit; display: block;
}
.quick-action-btn:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); color: #2c5f2d; }
.quick-action-btn i { font-size: 2rem; margin-bottom: 0.5rem; color: #2c5f2d; }

.stat-number { font-size: 2rem; font-weight: 700; }
.stat-label  { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }

/* ============================================================
   Alert positioning
   ============================================================ */
.alert-info { border-left: 4px solid #0dcaf0; }

/* ============================================================
   Compact workspace for Dogs / Owners pages
   ============================================================ */

/* --- Shared form-page base styles (dogs, owners) --- */
.form-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

table.dataTable tbody tr { cursor: pointer; }
table.dataTable tbody tr.selected { background-color: #d4edda !important; }

.btn-group-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* jQuery UI autocomplete dropdown */
.ui-autocomplete {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1050 !important;
}

body[data-page="dogs"] .admin-header,
body[data-page="owners"] .admin-header {
    padding: 0.45rem 0.95rem;
}

body[data-page="dogs"] .admin-header h4,
body[data-page="owners"] .admin-header h4 {
    font-size: 1.05rem;
    line-height: 1.2;
}

body[data-page="dogs"] .admin-header .btn,
body[data-page="owners"] .admin-header .btn {
    padding: 0.25rem 0.5rem;
}

body[data-page="dogs"] .admin-main > .container-fluid,
body[data-page="owners"] .admin-main > .container-fluid {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.65rem !important;
}

body[data-page="dogs"] .form-section,
body[data-page="owners"] .form-section {
    margin-bottom: 0;
    padding: 0.65rem 0.7rem;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    position: static;
    max-height: none;
    overflow: visible;
}

body[data-page="dogs"] .form-section .row,
body[data-page="owners"] .form-section .row {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.35rem;
}

body[data-page="dogs"] .form-section .row.mt-2,
body[data-page="owners"] .form-section .row.mt-2 {
    margin-top: 0.12rem !important;
}

body[data-page="dogs"] .form-section .form-label,
body[data-page="owners"] .form-section .form-label {
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

body[data-page="dogs"] .form-section .form-control,
body[data-page="dogs"] .form-section .form-select,
body[data-page="owners"] .form-section .form-control,
body[data-page="owners"] .form-section .form-select {
    min-height: 32px;
    height: 32px;
    padding: 0.2rem 0.45rem;
    font-size: 0.82rem;
}

body[data-page="dogs"] .form-section .btn-group-actions,
body[data-page="owners"] .form-section .btn-group-actions {
    gap: 0.35rem;
    margin-top: 0.55rem !important;
}

body[data-page="dogs"] .form-section .btn-group-actions .btn,
body[data-page="owners"] .form-section .btn-group-actions .btn {
    padding: 0.32rem 0.5rem;
    font-size: 0.78rem;
    line-height: 1.15;
    border-radius: 0.35rem;
}

body[data-page="dogs"] .form-section .btn-group-actions .btn i,
body[data-page="owners"] .form-section .btn-group-actions .btn i {
    margin-right: 0.25rem !important;
}

body[data-page="dogs"] .dataTables_wrapper,
body[data-page="owners"] .dataTables_wrapper {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    padding: 0.45rem 0.55rem 0.4rem;
    margin-bottom: 0;
}

body[data-page="dogs"] table.dataTable thead th,
body[data-page="owners"] table.dataTable thead th {
    font-size: 0.74rem;
    padding: 0.38rem 1.55rem 0.38rem 0.45rem;
    white-space: nowrap;
    position: relative;
    background-color: #e3e6ea;
    color: #2f3439;
    border-bottom: 1px solid #cfd4da;
}

body[data-page="dogs"] table.dataTable tbody td,
body[data-page="owners"] table.dataTable tbody td {
    font-size: 0.78rem;
    padding: 0.34rem 0.45rem;
}

body[data-page="dogs"] .dt-container .dt-search,
body[data-page="owners"] .dt-container .dt-search {
    gap: 0.35rem;
    margin: 0 0 0.35rem 0;
}

body[data-page="dogs"] .dt-container .dt-search label,
body[data-page="owners"] .dt-container .dt-search label {
    font-size: 0.78rem;
}

body[data-page="dogs"] .dt-container .dt-search input,
body[data-page="owners"] .dt-container .dt-search input {
    min-width: 150px;
    font-size: 0.8rem;
    padding: 0.22rem 0.45rem;
}

body[data-page="dogs"] .dt-container .dt-info,
body[data-page="dogs"] .dt-container .dt-paging,
body[data-page="owners"] .dt-container .dt-info,
body[data-page="owners"] .dt-container .dt-paging {
    font-size: 0.75rem;
}

body[data-page="owners"] #ownersTable thead th:nth-child(3),
body[data-page="owners"] #ownersTable tbody td:nth-child(3) {
    min-width: 13rem;
}
