/* ========================================================================== */
/* Admin Interface Styling */
/* ========================================================================== */

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
    max-width: 400px;
    width: 100%;
}

.login-box h1 {
    text-align: center;
    color: #333;
    margin: 0 0 10px 0;
    font-size: 24px;
}

.login-box h2 {
    text-align: center;
    color: #666;
    margin: 0 0 30px 0;
    font-size: 18px;
    font-weight: 400;
}

.login-form {
    margin-bottom: 30px;
}

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

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-footer {
    text-align: center;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.login-footer p {
    margin: 8px 0;
    font-size: 14px;
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

.text-muted {
    color: #999;
}

/* Admin Header */
.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.admin-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.admin-header h1 {
    margin: 0;
    font-size: 28px;
}

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
}

.user-name {
    font-weight: 500;
}

/* Admin Content */
.admin-content {
    max-width: 1200px;
    margin: 0 auto;
}

.admin-info {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.admin-info p {
    margin: 0;
    font-size: 14px;
}

.admin-info strong {
    color: #333;
}

/* Toolbar */
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 4px 4px 0 0;
    border: 1px solid #ddd;
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-toolbar.bottom-toolbar {
    border-radius: 0 0 4px 4px;
    border: 1px solid #ddd;
    border-top: none;
}

.admin-info-inline {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: #666;
}

.admin-toolbar-actions {
    display: flex;
    gap: 8px;
}

/* Editable table tweaks */
.editable-table td {
    padding: 6px 10px;
    vertical-align: middle;
}

.editable-table .col-check {
    text-align: center;
    width: 70px;
}

.editable-table .col-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.editable-table .col-version {
    width: 140px;
}

.editable-table .col-version select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    background: white;
}

.editable-table .col-version select:focus {
    outline: none;
    border-color: #667eea;
}

.editable-table .col-lines {
    text-align: right;
    width: 60px;
    color: #999;
    font-size: 12px;
}

.editable-table .col-name {
    min-width: 180px;
}

.editable-table .col-category {
    width: 80px;
}

tr.row-changed {
    background-color: #fff8e1 !important;
}

tr.row-changed td:first-child {
    border-left: 3px solid #e67e22;
}

/* Admin Table Wrapper — scrollable with sticky header */
.admin-table-wrapper {
    overflow: auto;
    max-height: calc(100vh - 220px);
    border: 1px solid #ddd;
    border-top: none;
    border-bottom: none;
}

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.admin-table thead {
    background: #f5f5f5;
}

.admin-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.05);
}

.admin-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.admin-table tbody tr:hover {
    background-color: #f9f9f9;
}

.admin-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: #666;
}

.admin-table code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #333;
}

/* Column Widths */
.col-name {
    min-width: 200px;
    font-weight: 500;
    color: #333;
}

.col-category {
    width: 120px;
}

.col-lines {
    width: 80px;
    text-align: right;
}

.col-status {
    width: 100px;
}

.col-pcode {
    width: 100px;
}

.col-versions {
    width: 200px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.col-actions {
    width: 120px;
    text-align: center;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.badge-secondary {
    background-color: #e2e3e5;
    color: #383d41;
}

.badge-admin {
    background-color: #cfe2ff;
    color: #084298;
}

.badge-category {
    background-color: #e7f3ff;
    color: #0066cc;
}

/* Forms */
.form-section {
    background: white;
    padding: 30px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 600px;
}

.form-section h2 {
    margin-top: 0;
    color: #333;
    font-size: 24px;
}

.form-info {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.form-info p {
    margin: 8px 0;
    font-size: 14px;
}

.form-info strong {
    color: #333;
}

.admin-form fieldset {
    border: 1px solid #ddd;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.admin-form legend {
    padding: 0 10px;
    font-weight: 600;
    color: #333;
}

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

.admin-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.admin-form input,
.admin-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.admin-form input:focus,
.admin-form select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.admin-form input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-weight: 400;
    margin-bottom: 0;
    cursor: pointer;
}

.checkbox-label span {
    margin: 0;
}

.form-help {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5568d3;
}

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out;
    transition: opacity 0.3s;
}

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

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

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

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.close-alert {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 0;
    margin-left: 10px;
}

.close-alert:hover {
    opacity: 1;
}

/* Links */
.link {
    color: #667eea;
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

/* Text Utilities */
.text-center {
    text-align: center;
}

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

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

    .admin-user-info {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-table {
        font-size: 12px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 12px;
    }

    .col-name {
        min-width: 150px;
    }

    .col-versions {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .login-box {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .admin-header h1 {
        font-size: 20px;
    }

    .admin-table {
        font-size: 11px;
    }

    .col-category,
    .col-lines,
    .col-status,
    .col-pcode {
        display: none;
    }

    .col-actions {
        width: auto;
    }

    .admin-info {
        grid-template-columns: 1fr;
    }
}
