/* Base styles */
:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --error-color: #dc3545;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --border-color: #dee2e6;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: white;
}

.btn-primary {
    background-color: var(--primary-color);
}

.btn-success {
    background-color: var(--success-color);
}

.btn-danger {
    background-color: var(--error-color);
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-sm {
    padding: 0 1rem;
    font-size: 0.875rem;
    height: 32px;
    min-width: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.table th,
.table td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.table th {
    background-color: var(--primary-color);
    color: white;
}

.table tr:nth-child(even) {
    background-color: #f2f2f2;
}

/* Cards */
.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.card-title {
    margin-top: 0;
    color: var(--primary-color);
}

/* Messages */
.flash-message {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.flash-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section-title {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* File controls consistency */
.file-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filename-input {
    width: 180px;
    height: 32px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    margin: 0;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    height: 32px;
}

.inline-form {
    margin: 0;
    height: 32px;
    display: inline-flex;
}

.hidden-file-input {
    display: none;
}

.upload-btn {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    margin: 0;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-10%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.close {
    font-size: 1.5rem;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 1rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.checkbox-group input[type="checkbox"] {
    margin: 0;
}

/* Table actions */
.table-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.table-actions-cell {
    padding: 0.5rem !important;
    text-align: center !important;
    white-space: nowrap;
}

.table-actions-cell .btn {
    margin: 0;
}

.table-actions-cell .button-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.table-actions-cell .btn-sm {
    padding: 0.25rem 0.75rem;
    min-width: 70px;
    height: 28px;
}

.table-actions-cell form {
    margin: 0;
    padding: 0;
    height: 28px;
}

/* Form in modal */
.modal .form-group {
    margin-bottom: 0;
}

.modal .form-control {
    margin-bottom: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .file-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .filename-input {
        width: 100%;
    }

    .button-group {
        width: 100%;
        justify-content: flex-start;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
}
