/* ============================================
   ADVANTEC MANAGER - MODERN UI THEME
   Base Colors: #007fff (Sky Blue) to #00d4ff (Cyan)
   ============================================ */

/* === CSS VARIABLES === */
:root {
    /* Primary Colors */
    --primary-blue: #007fff;
    --primary-cyan: #00d4ff;
    --primary-dark: #0056b3;
    --primary-light: #e8f4ff;

    /* Secondary Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;

    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
}

/* === BASE STYLES === */
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

h3 {
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h4 {
    font-size: 1.25rem;
    color: var(--gray-700);
}

/* === LINKS === */
a, .btn-link {
    color: var(--primary-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover, .btn-link:hover {
    color: var(--primary-dark);
}

/* === BUTTONS === */
.btn {
    font-weight: 500;
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
    color: white;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-blue));
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: white;
    border: none;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
    border: none;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-outline-secondary {
    background: transparent;
    color: var(--gray-600);
    border: 2px solid var(--gray-300);
}

.btn-outline-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* Collected Button Styles */
.collected-btn {
    background: linear-gradient(135deg, var(--success), #059669) !important;
    white-space: nowrap;
    min-width: 95px;
}

.collected-confirm-btn {
    background: linear-gradient(135deg, var(--warning), #d97706) !important;
    animation: pulse-warning 1s infinite;
    white-space: nowrap;
    min-width: 95px;
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
}

/* === FOCUS STATES === */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 127, 255, 0.25);
}

/* === FORMS === */
.form-control, .form-select {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    transition: all var(--transition);
    background-color: white;
}

.form-control:hover, .form-select:hover {
    border-color: var(--gray-300);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 127, 255, 0.15);
}

.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
    font-size: 0.9rem;
}

.form-select,
.form-select option,
select,
select option {
    color: var(--gray-800) !important;
    background-color: white !important;
}

.form-check-input:checked {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.priority-select,
.priority-select option {
    color: var(--gray-800) !important;
    background-color: white !important;
}

/* Validation States */
.valid.modified:not([type=checkbox]) {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.validation-message {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* === CARDS === */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* === TABLES === */
.table {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border-collapse: separate;
    border-spacing: 0;
}

.table thead {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
}

.table thead th {
    color: white;
    font-weight: 600;
    padding: 1rem;
    border: none;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: background-color var(--transition-fast);
    border-bottom: 1px solid var(--gray-100);
}

.table tbody tr:hover {
    background-color: var(--primary-light);
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border: none;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--gray-50);
}

.table-striped tbody tr:nth-of-type(odd):hover {
    background-color: var(--primary-light);
}

/* Priority Row Colors */
.table-danger {
    background-color: var(--danger-light) !important;
}

.table-danger:hover {
    background-color: #fecaca !important;
}

.table-info {
    background-color: var(--info-light) !important;
}

.table-info:hover {
    background-color: #a5f3fc !important;
}

.table-responsive {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-responsive table {
    table-layout: auto;
    width: 100%;
    margin-bottom: 0;
}

.table-responsive th,
.table-responsive td {
    white-space: normal;
}

/* Hover row for completed list */
.hover-row:hover {
    background-color: var(--primary-light) !important;
    cursor: pointer;
}

/* === BADGES === */
.badge {
    font-weight: 500;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.bg-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626) !important;
}

.badge.bg-success {
    background: linear-gradient(135deg, var(--success), #059669) !important;
}

.badge.bg-info {
    background: linear-gradient(135deg, var(--info), #0891b2) !important;
    color: white !important;
}

.badge.bg-warning {
    background: linear-gradient(135deg, var(--warning), #d97706) !important;
}

/* === SIDEBAR === */
.sidebar {
    background: linear-gradient(180deg, var(--primary-blue) 0%, #0056b3 100%) !important;
    box-shadow: var(--shadow-lg);
}

.nav-menu,
.nav-scrollable {
    background: transparent !important;
}

/* === MODALS === */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
    color: white;
    border: none;
    padding: 1.25rem 1.5rem;
}

.modal-header .modal-title {
    font-weight: 600;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    gap: 0.5rem;
}

/* === NOTIFICATIONS ICONS === */
.notif-icons {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.notif-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.notif-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    color: var(--gray-400);
    font-size: 0.8rem;
    transition: all var(--transition);
}

.notif-icon.sent {
    border-color: var(--success) !important;
    color: white !important;
    background: linear-gradient(135deg, var(--success), #059669) !important;
}

/* === CONTAINERS === */
.container {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

.content {
    padding-top: 1rem;
}

/* === STATUS SELECT === */
.form-select-sm {
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    font-size: 0.85rem;
    border-radius: var(--radius);
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.modal.show .modal-dialog {
    animation: fadeIn 0.2s ease-out;
}

/* === LOADING SPINNER === */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === HEADER/TOP BAR === */
header.fixed-top {
    background: white !important;
    box-shadow: var(--shadow);
    border-bottom: none !important;
}

header .nav-link {
    color: var(--gray-600) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius);
    transition: all var(--transition);
}

header .nav-link:hover {
    color: var(--primary-blue) !important;
    background: var(--primary-light);
}

header .nav-link.active {
    color: var(--primary-blue) !important;
    background: var(--primary-light);
}

/* === GLOBAL SEARCH BAR === */
.search-container {
    position: relative;
    max-width: 350px;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.9rem;
    pointer-events: none;
}

.search-input {
    padding-left: 38px !important;
    border-radius: var(--radius-lg) !important;
    border: 2px solid var(--gray-200) !important;
    background: var(--gray-50) !important;
    font-size: 0.9rem;
    height: 40px;
}

.search-input:focus {
    background: white !important;
    border-color: var(--primary-blue) !important;
    box-shadow: 0 0 0 3px rgba(0, 127, 255, 0.1) !important;
}

.search-input::placeholder {
    color: var(--gray-400);
}

/* === CUSTOM SCROLLBAR === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* === UTILITY CLASSES === */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
}

.glass-effect {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* === ERROR BOUNDARY === */
.blazor-error-boundary {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    padding: 1rem 1.5rem;
    color: white;
    border-radius: var(--radius);
    margin: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred. Please refresh the page.";
}

.darker-border-checkbox.form-check-input {
    border-color: var(--gray-400);
}

/* === IMAGE MODAL === */
.modal-fullscreen .modal-content {
    background: rgba(0, 0, 0, 0.95);
}

/* === PRINT STYLES === */
@media print {
    .sidebar, header, .btn, .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

    .table thead {
        background: var(--gray-800) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* === RESPONSIVE === */

/* Tablet */
@media (max-width: 1024px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    h3 {
        font-size: 1.25rem;
    }

    .container {
        padding: 1rem 0.5rem;
    }

    /* Make tables horizontally scrollable */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
    }

    .table {
        min-width: 600px;
        font-size: 0.8rem;
    }

    .table thead th {
        padding: 0.5rem 0.4rem;
        font-size: 0.65rem;
        white-space: nowrap;
    }

    .table tbody td {
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
    }

    .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .collected-btn, .collected-confirm-btn {
        min-width: auto;
        padding: 0.25rem 0.4rem;
        font-size: 0.7rem;
    }

    /* Mobile header adjustments */
    header.fixed-top {
        padding: 0.5rem 0.75rem !important;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    header .nav-link {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem;
    }

    /* Modal adjustments for mobile */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-lg {
        max-width: 100%;
    }

    /* Form adjustments */
    .form-control, .form-select {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    /* Notification icons smaller on mobile */
    .notif-icon {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }

    /* Badge adjustments */
    .badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }

    /* Status select smaller */
    .form-select-sm {
        font-size: 0.75rem;
        padding: 0.3rem 1.5rem 0.3rem 0.5rem;
    }

    /* Main content padding adjustment */
    main {
        padding: 0.75rem !important;
        padding-top: 70px !important;
    }
}

/* Small phones */
@media (max-width: 480px) {
    h3 {
        font-size: 1.1rem;
    }

    .table {
        min-width: 500px;
        font-size: 0.75rem;
    }

    .table thead th {
        padding: 0.4rem 0.3rem;
        font-size: 0.6rem;
    }

    .table tbody td {
        padding: 0.4rem 0.3rem;
    }

    /* Hide some columns on very small screens */
    .hide-mobile {
        display: none !important;
    }

    /* Stack buttons vertically */
    .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    /* Full width buttons on mobile */
    .btn-mobile-full {
        width: 100%;
    }

    /* Adjust header */
    header.fixed-top {
        justify-content: space-between;
    }

    header .nav-link {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.75rem;
    }

    /* Modal footer buttons */
    .modal-footer {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1 1 auto;
        min-width: calc(50% - 0.25rem);
    }
}

/* Sidebar hide on mobile - handled by layout */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .d-flex.vh-100 > .flex-grow-1 {
        width: 100%;
    }
}

/* Touch-friendly tap targets */
@media (pointer: coarse) {
    .btn, .form-control, .form-select, .nav-link {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 36px;
    }

    .table tbody tr {
        min-height: 48px;
    }
}
