/**
 * СВЕТЛО-КОРИЧНЕВАЯ ТЕМА
 * ======================
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5e6d3, #e8d5b5);
    min-height: 100vh;
}

/* ======================================== */
/* СТРАНИЦА ВХОДА */
/* ======================================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(139, 69, 19, 0.15);
}

.login-card h1 {
    color: #8b4513;
    font-size: 28px;
    margin-bottom: 30px;
    text-align: center;
}

/* ======================================== */
/* ОБЩИЕ СТИЛИ */
/* ======================================== */

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #d4b99c;
    border-radius: 12px;
    font-size: 16px;
    transition: border-color 0.3s;
    background-color: #fff9f0;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #8b4513;
    background-color: white;
}

.form-group input[readonly] {
    background: #f0e6d8;
    cursor: not-allowed;
}

.form-group small {
    display: block;
    color: #8b6b4d;
    font-size: 12px;
    margin-top: 5px;
}

/* ======================================== */
/* КНОПКИ */
/* ======================================== */

.btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #8b4513, #654321);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background: linear-gradient(135deg, #8b4513, #654321);
}

.btn-secondary {
    background: #a0522d;
}

.btn-logout {
    padding: 10px 20px;
    background: #cd5c5c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.btn-edit {
    background: #d2691e;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-link {
    background: #228B22;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-history {
    background: #8b4513;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

/* ======================================== */
/* НОВЫЕ КНОПКИ ДЛЯ ПЛАТЕЖЕЙ И ВЕБХУКОВ */
/* ======================================== */

.btn-pay {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-pay:hover {
    background: #218838;
}

.btn-webhook {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-webhook:hover {
    background: #138496;
}

/* ======================================== */
/* АДМИН-ПАНЕЛЬ */
/* ======================================== */

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

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(139, 69, 19, 0.1);
}

.admin-header h1 {
    color: #8b4513;
    font-size: 24px;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    background: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    color: #5d3a1a;
}

.tab-btn.active {
    background: #8b4513;
    color: white;
}

.tab-content {
    display: none;
}

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

/* ======================================== */
/* КАРТОЧКИ МЕСТ */
/* ======================================== */

.spaces-list {
    display: grid;
    gap: 20px;
}

.space-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(139, 69, 19, 0.1);
    transition: transform 0.2s;
}

.space-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(139, 69, 19, 0.15);
}

.space-card.inactive {
    opacity: 0.6;
    background: #f5f0e8;
}

.space-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #d4b99c;
}

.space-number-container {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 20px;
}

.space-parking-number {
    font-size: 24px;
    font-weight: bold;
    color: #8b4513;
    line-height: 1.2;
}

.space-system-number {
    font-size: 14px;
    color: #a0522d;
    white-space: nowrap;
}

.space-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.space-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.space-details p {
    margin: 5px 0;
    color: #5d3a1a;
}

.space-details strong {
    color: #8b4513;
}

/* ======================================== */
/* МОДАЛЬНЫЕ ОКНА */
/* ======================================== */

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

.modal-content {
    background: white;
    border-radius: 24px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-content pre {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 5px;
    overflow: auto;
    max-height: 300px;
}

.close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #a0522d;
    z-index: 10;
}

.close:hover {
    color: #8b4513;
}

/* ======================================== */
/* ТАБЛИЦЫ */
/* ======================================== */

.payments-table {
    width: 100%;
    border-collapse: collapse;
}

.payments-table th {
    background: #f5e6d3;
    padding: 10px;
    text-align: left;
    border-bottom: 2px solid #d4b99c;
    color: #8b4513;
}

.payments-table td {
    padding: 10px;
    border-bottom: 1px solid #d4b99c;
    color: #5d3a1a;
}

.payments-table tr:hover {
    background: #fdf5e6;
}

/* ======================================== */
/* УПРАВЛЕНИЕ АДРЕСАМИ */
/* ======================================== */

.addresses-list {
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
}

.address-item {
    background: #fdf5e6;
    border: 1px solid #d4b99c;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.address-item:hover {
    background: #fff5e8;
    border-color: #8b4513;
}

.address-item.inactive {
    opacity: 0.6;
    background: #f0e6d8;
}

.address-info {
    flex: 1;
}

.address-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.address-title strong {
    font-size: 16px;
    color: #8b4513;
}

.address-description {
    color: #5d3a1a;
    font-size: 14px;
    margin-bottom: 5px;
}

.address-meta small {
    color: #a0522d;
    font-size: 12px;
}

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

.btn-address-edit,
.btn-address-delete,
.btn-address-toggle {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-address-edit {
    background: #d2691e;
    color: white;
}

.btn-address-edit:hover {
    background: #b85e1a;
    transform: scale(1.05);
}

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

.btn-address-delete:hover {
    background: #b84c4c;
    transform: scale(1.05);
}

.btn-address-toggle {
    background: #228B22;
    color: white;
}

.btn-address-toggle:hover {
    background: #1e7a1e;
    transform: scale(1.05);
}

.empty-message {
    text-align: center;
    color: #a0522d;
    padding: 30px;
    background: #fdf5e6;
    border-radius: 10px;
    border: 2px dashed #d4b99c;
}

/* ======================================== */
/* СТРАНИЦА ОПЛАТЫ */
/* ======================================== */

.payment-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.payment-card {
    background: white;
    border-radius: 24px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(139, 69, 19, 0.15);
}

.payment-card h1 {
    color: #8b4513;
    font-size: 28px;
    margin-bottom: 10px;
    text-align: center;
}

.payment-method-badge {
    background: linear-gradient(135deg, #8b4513, #654321);
    color: white;
    padding: 8px 16px;
    border-radius: 30px;
    display: inline-block;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.space-info {
    background: #fdf5e6;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.space-info p {
    margin: 8px 0;
    color: #5d3a1a;
}

.space-info strong {
    color: #8b4513;
}

.btn-pay {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #228B22, #1e7a1e);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
}

.btn-pay:hover {
    opacity: 0.9;
}

/* ======================================== */
/* QR-КОД */
/* ======================================== */

.qr-info {
    background: #f5e6d3;
    border-left: 4px solid #8b4513;
    padding: 12px;
    border-radius: 8px;
    margin: 20px 0;
    font-size: 14px;
}

.qr-container {
    text-align: center;
    padding: 20px;
}

.qr-image {
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.15);
    display: inline-block;
}

.qr-image img {
    width: 200px;
    height: 200px;
    display: block;
}

.qr-status {
    font-size: 16px;
    margin: 15px 0;
    padding: 10px;
    border-radius: 8px;
    background: #fdf5e6;
}

.qr-status.success {
    background: #dff0d8;
    color: #228B22;
}

.qr-status.error {
    background: #f2dede;
    color: #cd5c5c;
}

/* ======================================== */
/* ПРОБЛЕМНЫЕ ЧЕКИ */
/* ======================================== */

.badge {
    background: #cd5c5c;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    margin-left: 5px;
}

.problem-card {
    background: white;
    border-left: 4px solid #cd5c5c;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(139, 69, 19, 0.1);
}

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

.problem-amount {
    font-weight: bold;
    color: #8b4513;
}

.btn-resend {
    background: #228B22;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-resend:hover {
    background: #1e7a1e;
}

.receipt-error {
    background: #f2dede;
    color: #cd5c5c;
    padding: 8px;
    border-radius: 4px;
    margin-top: 10px;
    font-family: monospace;
    font-size: 12px;
}

/* ======================================== */
/* ЛОГИ */
/* ======================================== */

.logs-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.logs-controls select {
    padding: 8px;
    border: 2px solid #d4b99c;
    border-radius: 8px;
    min-width: 200px;
    background: white;
}

.logs-content {
    background: #2d2d2d;
    color: #f0f0f0;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

/* ======================================== */
/* АДАПТИВНОСТЬ */
/* ======================================== */

@media (max-width: 768px) {
    .space-details {
        grid-template-columns: 1fr;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .space-number-container {
        flex-direction: column;
        gap: 2px;
    }
    
    .space-system-number {
        margin-left: 0;
    }
    
    .address-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .address-actions {
        align-self: flex-end;
    }
    
    /* Адаптивность для новых кнопок */
    .space-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .space-actions button {
        width: 100%;
        margin: 2px 0;
    }
}

/* ======================================== */
/* ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ДЛЯ МОДАЛЬНЫХ ОКОН */
/* ======================================== */

.modal-content h2 {
    color: #8b4513;
    margin-bottom: 20px;
}

.modal-content p {
    color: #5d3a1a;
    margin: 10px 0;
}

.modal-content .btn {
    margin-top: 10px;
}

/* Стили для блока тестирования вебхуков */
#webhookTestResult {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
}

#webhookTestResult p {
    margin: 5px 0;
}