/* Data Pegawai Inspektorat Styles */
.data-container {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 1rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.action-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-container {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.25rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.btn-add {
    padding: 0.6rem 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.data-table-container {
    background-color: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
    overflow: hidden;
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    max-width: 100%;
}

.data-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.data-table th {
    padding: 0.75rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: normal;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Biarkan kolom mengikuti isi, hanya kolom No / Foto / Aksi yang fixed */
.data-table th:first-child,
.data-table td:first-child {
    width: 56px;
    min-width: 56px;
    white-space: nowrap;
    text-align: center;
    padding: 0.5rem 0.25rem;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    width: 90px;
    min-width: 90px;
    text-align: center;
    padding: 0.5rem;
}

.data-table th:last-child,
.data-table td:last-child {
    width: 160px;
    min-width: 160px;
    white-space: nowrap;
    text-align: center;
    padding: 0.5rem;
}

.data-table th:last-child {
    border-right: none;
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    vertical-align: middle;
    white-space: normal;
}

/* Wrapper isi cell: maksimal 6 baris, sisanya discroll */
.data-table .cell-scroll {
    display: block;
    line-height: 1.4;
    max-height: calc(1.4em * 6);
    overflow: auto;
    padding-right: 2px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.data-table td:last-child {
    border-right: none;
}

.table-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.table-image:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px var(--shadow);
}

.image-placeholder {
    width: 50px;
    height: 50px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.25rem;
    margin: 0 auto;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background-color: var(--bg-secondary);
}

.data-table tbody tr.draggable-row {
    cursor: move;
    cursor: grab;
}

.data-table tbody tr.draggable-row:active {
    cursor: grabbing;
}

.data-table tbody tr.dragging {
    opacity: 0.5;
    background-color: var(--bg-secondary);
}

.data-table tbody tr.drag-over {
    border-top: 3px solid #667eea;
}

.drag-handle {
    cursor: move;
    cursor: grab;
    color: var(--text-secondary);
    padding: 0.25rem;
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.drag-handle:active {
    cursor: grabbing;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.9rem;
}

.action-buttons {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    flex-wrap: nowrap;
}

.btn-action {
    padding: 0.4rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.btn-edit {
    background-color: #ffc107;
    color: #000;
}

.btn-edit:hover {
    background-color: #ffb300;
}

.btn-delete {
    background-color: #dc3545;
    color: #fff;
}

.btn-delete:hover {
    background-color: #c82333;
}

.btn-view {
    background-color: #667eea;
    color: #fff;
}

.btn-view:hover {
    background-color: #5568d3;
}

/* Modal Styles */
.pegawai-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.pegawai-modal.active,
.pegawai-modal[style*="display: flex"],
.pegawai-modal[style*="display:flex"] {
    display: flex !important;
}

.pegawai-modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.pegawai-modal-content::-webkit-scrollbar {
    display: none;
}

.pegawai-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.pegawai-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.pegawai-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 1.1rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.pegawai-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.pegawai-modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-label .required {
    color: #dc3545;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.file-upload-wrapper {
    position: relative;
}

.form-file-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.file-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.file-upload-label:hover {
    border-color: #667eea;
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.foto-preview {
    margin-top: 1rem;
    position: relative;
    display: inline-block;
}

.foto-preview img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.remove-foto {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 0.8rem;
}

.remove-foto:hover {
    background: #c82333;
    transform: scale(1.1);
}

.btn-submit,
.btn-cancel {
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-cancel {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-cancel:hover {
    background: var(--border-color);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile Cards */
.data-cards-container {
    display: none;
    background-color: transparent;
}

.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.pengguna-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
    padding: 1rem;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.pengguna-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.card-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card-image-wrapper {
    width: 100%;
    height: 120px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    transition: var(--transition);
}

.card-image:hover {
    transform: scale(1.05);
}

.card-image-placeholder {
    width: 80px;
    height: 80px;
    background: var(--bg-secondary);
    border: 3px dashed var(--border-color);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    gap: 0.5rem;
}

.card-image-placeholder i {
    font-size: 1.5rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.5rem 0;
}

.card-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.info-item i {
    width: 16px;
    color: var(--text-secondary);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-actions .btn-action {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .desktop-view {
        display: none !important;
    }
    
    .mobile-view {
        display: block !important;
    }
    
    .data-cards-container {
        display: block;
    }
    
    .action-bar {
        flex-direction: column;
    }
    
    .search-container {
        width: 100%;
    }
    
    .btn-add {
        width: 100%;
        justify-content: center;
    }
    
    .data-container {
        padding: 0 0.75rem;
        margin: 0.75rem auto;
    }
}

@media (min-width: 769px) {
    .desktop-view {
        display: block !important;
    }
    
    .mobile-view {
        display: none !important;
    }
}
