* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 30px;
}

h1 {
    color: #333;
    margin-bottom: 10px;
}

.stats {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
}

.stat {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #007bff;
}

.stat-label {
    color: #666;
    font-size: 14px;
    margin-top: 5px;
}

.quick-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.action-button {
    flex: 1;
    padding: 15px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.action-button:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.section.collapsible {
    overflow: hidden;
}

.section h2 {
    margin-bottom: 15px;
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

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

button {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

button:hover:not(:disabled) {
    background: #0056b3;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.actions {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

td button {
    transition: all 0.2s ease;
}

td button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

td button:active:not(:disabled) {
    transform: translateY(0);
}

th {
    background: #007bff;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

tr:hover {
    background: #f8f9fa;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 800px;
    max-height: 80vh;
    overflow: auto;
    width: 90%;
}

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

.close {
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

pre {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    overflow: auto;
    max-height: 400px;
}

code {
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.status {
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
}

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

.status.success {
    background: #d4edda;
    color: #155724;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
}

.progress {
    margin-top: 10px;
    padding: 10px;
    background: #e9ecef;
    border-radius: 4px;
}

/* Блок с ключами кладовок/машиномест без квартир */
.orphan-keys-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 6px;
}

.orphan-keys-section h3 {
    margin-bottom: 15px;
    color: #856404;
    font-size: 18px;
}

.orphan-keys-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.orphan-key-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: white;
    border-radius: 4px;
    border-left: 4px solid #ffc107;
}

.orphan-key-code {
    flex-shrink: 0;
}

.orphan-key-code code {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #856404;
    border: 1px solid #ffc107;
}

.orphan-key-objects {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.orphan-key-object {
    padding: 6px 12px;
    background: #fff3cd;
    border-radius: 4px;
    font-size: 13px;
    color: #856404;
    border: 1px solid #ffc107;
}

/* Статистика по адресам */
.address-stats {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
}

.address-stats h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.address-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.address-stat-card {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #007bff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.address-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.address-stat-header strong {
    color: #333;
    font-size: 16px;
}

.address-stat-total {
    background: #007bff;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.address-stat-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stat-badge {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

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

.stat-badge.storeroom {
    background: #fff3cd;
    color: #856404;
}

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

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

.address-entrances {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

/* Вкладки */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    padding: 12px 24px;
    background: transparent;
    color: #666;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.tab-button:hover {
    color: #007bff;
    background: #f8f9fa;
}

.tab-button.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background: #f8f9fa;
}

.tab-content {
    display: none;
}

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


/* Дополнительные стили для PHP-админки */
.tabs {
    display: flex;
    gap: 10px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    color: #333;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.tab.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.action-button.active {
    background: #0056b3;
    box-shadow: 0 4px 12px rgba(0, 91, 187, 0.2);
}

.details-btn {
    padding: 8px 12px;
    cursor: pointer;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    text-align: left;
}

.small-btn {
    padding: 8px 12px;
    cursor: pointer;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    flex: 1;
}

.small-btn.success { background: #28a745; }
.small-btn.info { background: #17a2b8; }

.delete-btn {
    padding: 8px 12px;
    cursor: pointer;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    margin-top: 6px;
}
