/**
 * Shrish Admin Panel - Manager Hub Stylesheet (V3.0 - Professional & Animated)
 * This file styles the search functionality, interactive result cards,
 * signature modal, and all associated animations.
 */

/* --- 1. Filter Card Styling --- */
.filter-controls {
    display: grid;
    /* Creates a responsive grid for the filter inputs */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    align-items: end; /* Aligns the button to the bottom with the inputs */
}

.search-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-group label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.search-group input {
    padding: 10px 12px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--color-border);
    transition: all var(--transition-speed);
}

.search-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.filter-controls .btn-primary {
    padding: 10px 12px;
    height: 42px; /* Match input height for perfect alignment */
    justify-content: center;
}

/* --- 2. Results Container & States (Loading, No Results) --- */
#results-container {
    margin-top: 2rem;
    position: relative;
    min-height: 200px;
}

/* Loading Spinner */
.loader {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 3rem auto;
}

/* No Results Message */
.no-results-card {
    text-align: center;
    padding: 3rem;
    background-color: var(--color-bg-card);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--color-border);
}

.no-results-card i {
    font-size: 3rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.no-results-card p {
    color: var(--color-text-muted);
    font-size: 1.1rem;
    margin: 0;
}

/* --- 3. The Interactive Slip Card --- */
.slip-card {
    background-color: var(--color-bg-card);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: all var(--transition-speed);
    border-left: 5px solid transparent; /* Default for conditional styling */
}

.slip-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Card Header */
.slip-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: #f9fafb;
    border-bottom: 1px solid var(--color-border);
}

.slip-card-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.slip-card-header .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-badge.status-new { background-color: #dbeafe; color: #1e40af; }
.status-badge.status-closed-by-driver { background-color: #fef08a; color: #854d0e; }
.status-badge.status-closed-by-client { background-color: #dcfce7; color: #166534; }
.status-badge.status-updated-by-manager { background-color: #e0e7ff; color: #3730a3; }

/* Card Body */
.slip-card-body {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-item { display: flex; align-items: start; gap: 1rem; }
.info-item i { font-size: 1.1rem; color: var(--color-primary); margin-top: 5px; width: 20px; text-align: center; }
.info-item-content p { margin: 0; color: var(--color-text-muted); font-size: 0.9rem; }
.info-item-content p strong { color: var(--color-text-dark); display: block; font-size: 1rem; }

/* Card Actions */
.slip-card-actions {
    padding: 1rem 1.5rem;
    background-color: #f9fafb;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.action-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    background-color: white;
    color: var(--color-text-dark);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-speed);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
}
.action-link:hover { background-color: var(--color-primary); border-color: var(--color-primary); color: white; }

/* --- 4. Signature Thumbnail & Modal --- */
.signature-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e0e7ff;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
    overflow: hidden;
}
.signature-thumbnail:hover { transform: scale(1.1); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.signature-thumbnail img { width: 100%; height: 100%; object-fit: contain; }
.signature-thumbnail i { color: var(--color-primary); font-size: 1.2rem; }

/* Modal Styles */
#image-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all 0.4s ease; }
#image-modal.visible { opacity: 1; visibility: visible; }
#modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(17, 24, 39, 0.8); backdrop-filter: blur(5px); }
.modal-content { position: relative; background: white; padding: 1.5rem; border-radius: var(--border-radius-md); box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25); transform: scale(0.95); transition: all 0.4s ease; max-width: 90%; max-height: 90%; }
#image-modal.visible .modal-content { transform: scale(1); }
#modal-img { display: block; max-width: 500px; max-height: 250px; width: 100%; height: auto; background-color: #f9fafb; border: 1px solid var(--color-border); border-radius: var(--border-radius-md); }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; justify-content: center; }
.modal-actions .close-btn { background-color: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.modal-actions .close-btn:hover { background-color: #ef4444; color: white; border-color: #ef4444; }

/* --- 5. Conditional Card Styling --- */
.slip-card--new { border-left-color: #60a5fa; }
.slip-card--closed-by-driver { border-left-color: #facc15; }
.slip-card--closed-by-client { border-left-color: #4ade80; }
.slip-card--updated-by-manager { border-left-color: var(--color-primary); }

/* --- 6. Animations & Transitions --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.5s ease-out forwards; }

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

.results-container.fading-out > * {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.slip-card.is-loading {
    opacity: 0;
    transform: translateY(20px);
}

.slip-card {
    /* The stagger effect is controlled by the --delay-index variable from JS */
    transition: opacity 0.5s ease-out, transform 0.5s ease-out, box-shadow var(--transition-speed), border-color var(--transition-speed);
    transition-delay: calc(var(--delay-index, 0) * 70ms);
}