/* Monitor.html CSS */
:root {
    --primary-color: #00B14F;
    --primary-dark: #009943;
    --primary-light: #00C95A;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --background-card: #ffffff;
    --border-color: #e5e7eb;
    --gray-light: #f3f4f6;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   MODAL BACKDROP
   ======================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    animation: backdropFadeIn 0.3s ease-in-out;
}

@keyframes backdropFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   MODERN MODAL
   ======================================== */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#modernModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    animation: backdropFadeIn 0.3s ease-out;
    justify-content: center;
    align-items: center;
}

#modernModal.show {
    display: flex;
}

.modal-content-modern {
    background: white;
    border-radius: 16px;
    padding: 0;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.modal-header-modern {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafb 0%, #ffffff 100%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-header-modern .modal-icon {
    font-size: 1.5rem;
    min-width: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header-modern.success .modal-icon { color: #10b981; }
.modal-header-modern.error .modal-icon { color: #ef4444; }
.modal-header-modern.warning .modal-icon { color: #f59e0b; }
.modal-header-modern.info .modal-icon { color: #3b82f6; }

.modal-header-modern h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body-modern {
    padding: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.modal-footer-modern {
    padding: 1.5rem;
    background: #f9fafb;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-width: 90px;
}

.modal-btn-primary {
    background: var(--primary-color);
    color: white;
    flex: 1;
}

.modal-btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(0, 177, 79, 0.3);
}

.modal-btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.modal-btn-secondary:hover {
    background: #d1d5db;
}

.modal-btn-danger {
    background: #ef4444;
    color: white;
    flex: 1;
}

.modal-btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.hidden {
    display: none !important;
}

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ========================================
   CONTAINER & CARD
   ======================================== */
.monitor-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #f8fafb 0%, #ffffff 100%);
}

.card-header i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.card-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 2rem;
}

/* ========================================
   TOOLBAR
   ======================================== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-wrapper {
    flex: 1;
    min-width: 250px;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: var(--transition);
}

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

.button-group {
    display: flex;
    gap: 0.75rem;
}

.btn-refresh {
    background-color: #007bff !important;
    width: auto;
    padding: 0.875rem 1.5rem;
    height: auto;
    margin-top: 0;
}

.btn-refresh:hover {
    background-color: #0056b3 !important;
}

.btn-export {
    background-color: #28a745 !important;
    width: auto;
    padding: 0.875rem 1.5rem;
    height: auto;
    margin-top: 0;
}

.btn-export:hover {
    background-color: #1e7e34 !important;
}

/* ========================================
   LOADING CONTAINER
   ======================================== */
.loading-container {
    display: none;
    text-align: center;
    padding: 2rem;
}

.loading-container .loader {
    margin: 0 auto;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   DATA TABLE
   ======================================== */
.table-container {
    overflow-x: auto;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table thead tr {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.data-table th {
    padding: 1rem;
    border-right: 1px solid #dee2e6;
    font-weight: 600;
    color: var(--text-primary);
}

.data-table th:last-child,
.data-table th.th-action {
    border-right: none;
}

.data-table tbody tr {
    border-bottom: 1px solid #dee2e6;
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

.data-table td {
    padding: 1rem;
    border-right: 1px solid #dee2e6;
}

.data-table td:last-child {
    border-right: none;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #999;
}

/* ========================================
   PAGINATION
   ======================================== */
.pagination-container {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pagination-info,
.pagination-limit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-label {
    color: #666;
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.page-numbers {
    display: flex;
    gap: 0.2rem;
}

.pagination-btn {
    padding: 0.6rem 0.8rem;
    background: white;
    color: #00B14F;
    border: 1px solid #00B14F;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.pagination-btn:hover {
    background: #00B14F;
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.limit-select {
    padding: 0.6rem 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    background: white;
    color: #333;
    cursor: pointer;
    font-weight: 500;
}

/* ========================================
   MODAL EDIT
   ======================================== */
.modal-edit {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-edit-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafb 100%);
    margin: 5% auto;
    border: none;
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-edit-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
}

.modal-edit-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 700;
}

.close-modal-edit {
    color: var(--text-secondary);
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    transition: color 0.3s;
}

.close-modal-edit:hover {
    color: var(--primary-color);
}

.modal-edit-body {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-edit-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: #f9fafb;
}

/* ========================================
   FORM MODAL
   ======================================== */
.form-group-modal {
    margin-bottom: 1.5rem;
}

.form-group-modal label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-group-modal input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    box-sizing: border-box;
    background: var(--background-card);
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition);
}

.form-group-modal input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 177, 79, 0.1);
}

.form-group-modal input:hover:not(:focus) {
    border-color: var(--primary-light);
}

.input-readonly,
.form-group-modal input[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
    color: var(--text-secondary);
}

.form-row-modal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-row-modal .form-group-modal {
    margin-bottom: 0;
}

/* ========================================
   BUTTONS
   ======================================== */
.button-group button {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.button-group button:active {
    transform: translateY(1px);
}

.btn-save {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 177, 79, 0.3);
}

.btn-save:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 16px rgba(0, 177, 79, 0.4);
}

.btn-cancel {
    background: var(--text-secondary);
    color: white;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.2);
}

.btn-cancel:hover {
    background: #4b5563;
    box-shadow: 0 6px 16px rgba(107, 114, 128, 0.3);
}

/* ========================================
   ACTION BUTTONS (TABLE)
   ======================================== */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.btn-edit {
    background: #f59e0b;
    color: white;
    padding: 0.675rem 1.2rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.btn-edit:hover {
    background-color: #d97706;
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}

.btn-delete {
    background: #dc2626;
    color: white;
    padding: 0.675rem 1.2rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.btn-delete:hover {
    background-color: #b91c1c;
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
    transform: translateY(-2px);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
    }
    
    .search-wrapper {
        width: 100%;
    }
    
    .button-group {
        width: 100%;
        justify-content: flex-end;
    }
    
    .form-row-modal {
        grid-template-columns: 1fr;
    }
    
    .pagination-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .modal-edit-content {
        width: 95%;
        max-width: 95%;
        margin: 10% auto;
    }
}
