/* Admin Panel Styles */
.admin-body {
    background: #f5f7fa;
    min-height: 100vh;
}

.admin-header {
    background: #2c3e50;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.admin-nav {
    background: white;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-menu {
    list-style: none;
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-menu li {
    margin: 0;
}

.nav-menu a {
    display: block;
    padding: 15px 25px;
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background: #f8f9fa;
}

.admin-main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.admin-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.08);
}

.admin-card h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Login Page */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.login-btn:hover {
    background: #2980b9;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th {
    background: #2c3e50;
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

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

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-edit {
    background: #3498db;
    color: white;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-view {
    background: #2ecc71;
    color: white;
}

.btn-edit:hover { background: #2980b9; }
.btn-delete:hover { background: #c0392b; }
.btn-view:hover { background: #27ae60; }

/* Form Editor */
.form-editor {
    display: grid;
    gap: 20px;
}

.field-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.field-actions {
    display: flex;
    gap: 10px;
}

.options-list {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 5px;
    border: 1px solid #eee;
}

.option-item {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.add-option-btn,
.add-field-btn {
    background: #2ecc71;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

.add-option-btn:hover,
.add-field-btn:hover {
    background: #27ae60;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #3498db;
    margin: 10px 0;
}

.stat-label {
    color: #666;
    font-size: 1rem;
}

/* Search and Filters */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.filter-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 8px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

/* Table Sorting */
.sort-indicator {
    margin-left: 5px;
    font-size: 0.8em;
    color: #666;
}

th[data-direction="asc"] .sort-indicator {
    color: #3498db;
}

th[data-direction="desc"] .sort-indicator {
    color: #3498db;
}

/* Selected Rows */
tr.selected {
    background-color: #e3f2fd !important;
}

.row-checkbox {
    margin: 0;
    cursor: pointer;
}

/* Bulk Actions */
.bulk-actions {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.bulk-actions select {
    min-width: 150px;
}

.apply-bulk:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Form Validation */
input.error,
select.error,
textarea.error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2) !important;
}

.field-error {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Toggle Sections */
.toggle-section {
    margin-bottom: 20px;
}

.toggle-header {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #2c3e50;
    border: 1px solid #ddd;
}

.toggle-header:hover {
    background: #e9ecef;
}

.toggle-header.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.toggle-content {
    padding: 20px;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    display: none;
}

.toggle-content.active {
    display: block;
}

/* Charts */
.stat-chart {
    width: 100%;
    height: 200px;
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-top: 15px;
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.search-loading {
    color: #666;
    font-size: 0.9rem;
}

/* Responsive Tables */
@media (max-width: 768px) {
    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .bulk-actions select {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .admin-nav,
    .form-actions,
    .bulk-actions,
    .action-buttons {
        display: none !important;
    }
    
    .admin-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}