/* ============================================
   IMPROVEMENTS CSS - Fix layout issues
   ============================================ */

/* Fix modal layout */
.modal-content form {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.modal-content form > *:not(.modal-footer) {
    margin-bottom: 16px;
}

.modal-content form .modal-footer {
    margin-bottom: -30px;
    margin-left: -30px;
    margin-right: -30px;
    padding: 20px 30px;
    border-radius: 0 0 15px 15px;
}

/* Fix form container spacing */
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* Fix input focus state */
input:focus,
select:focus,
textarea:focus {
    outline: none !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

/* Fix table responsiveness */
.table-responsive {
    border-radius: 8px;
    border: 1px solid #e8e8e8;
}

/* Fix form display in modal */
.form-section {
    margin-bottom: 20px;
}

.form-section:last-child {
    margin-bottom: 0;
}

/* Fix button group alignment */
.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-group .btn {
    flex-shrink: 0;
}

/* Fix topbar user profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

/* Fix sidebar header */
.sidebar-header {
    padding: 22px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.5px;
    margin: 0;
}

.sidebar-header i {
    font-size: 22px;
}

/* Fix menu spacing */
.sidebar-menu {
    padding: 12px 0;
}

.sidebar-menu a {
    font-size: 13px;
}

/* Fix logout button */
.logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 25px;
    font-size: 13px;
}

/* Better label styling */
label {
    color: #333;
}

/* Fix select dropdown */
select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 35px !important;
}

/* Fix info text */
.text-muted {
    color: #999;
    font-size: 12px;
    margin-top: 6px;
}

/* Better spacing for tables */
.card .table-responsive {
    margin: 0;
}

/* Fix alert styling */
.alert {
    border-radius: 10px;
    border-left: 4px solid;
    padding: 15px 18px;
    margin-bottom: 20px;
}

.alert-danger {
    border-left-color: #721c24;
}

.alert-success {
    border-left-color: #155724;
}

.alert-warning {
    border-left-color: #856404;
}

/* Fix modal header padding */
.modal-header {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e8e8e8;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

/* Better responsive table */
@media (max-width: 768px) {
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .search-bar input,
    .search-bar select {
        width: 100% !important;
        min-width: auto !important;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .page-actions {
        width: 100%;
    }
    
    .page-actions .btn {
        flex: 1;
        min-width: 100px;
    }
}

/* Fix mobile sidebar */
@media (max-width: 480px) {
    .sidebar-header {
        padding: 18px 20px;
    }
    
    .sidebar-header h2 {
        font-size: 15px;
    }
    
    .menu-item {
        padding: 12px 20px;
        font-size: 12px;
    }
    
    .logout-btn {
        padding: 12px 20px;
    }
    
    .topbar {
        padding: 14px 15px;
    }
    
    .content {
        padding: 15px 15px;
    }
    
    .modal-content {
        width: 90%;
        max-width: 100%;
        padding: 20px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .form-group label {
        font-size: 12px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 13px;
    }
}
