/* Стили главной страницы HakerMac. */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 1400px;
    width: 100%;
    height: 90vh;
    background: #16213e;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    display: flex;
    overflow: hidden;
    position: relative;
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #0f3460;
    position: relative;
}

.main-content::-webkit-scrollbar {
    width: 8px;
}
.main-content::-webkit-scrollbar-track {
    background: #1a1a2e;
}
.main-content::-webkit-scrollbar-thumb {
    background: #e94560;
    border-radius: 10px;
}

/* ===== HEADER СТАТИСТИКИ ===== */
.header-with-stats {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    border-bottom: 2px solid #1a1a2e;
    padding-bottom: 15px;
    flex-wrap: wrap;
}

.tabs {
    display: flex;
    gap: 15px;
    flex: 1;
    flex-wrap: wrap;
}

.stats-icon {
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 24px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 50%;
    transition: all 0.3s;
    display: none;
    /* Скрыто по умолчанию, показывается только админу */
}

.stats-icon:hover {
    background: rgba(233, 69, 96, 0.2);
    color: #e94560;
    transform: scale(1.1);
}

.stats-icon.active {
    background: #e94560;
    color: #fff;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.tab-btn {
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 20px;
    font-weight: 600;
    padding: 8px 25px;
    cursor: pointer;
    border-radius: 30px;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(233, 69, 96, 0.2);
}

.tab-btn.active {
    color: #fff;
    background: #e94560;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.content-area {
    min-height: 400px;
    position: relative;
}

/* ===== СТАТИСТИКА ===== */
.stats-container {
    display: none;
    padding: 20px 0;
}

.stats-container.active {
    display: block;
}

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

.stat-card {
    background: #1a1a2e;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    border-left: 5px solid #e94560;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.3s;
}

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

.stat-card .stat-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #e94560;
    margin-bottom: 5px;
}

.stat-card .stat-label {
    color: #888;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-refresh-btn {
    background: #e94560;
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
    display: none;
    margin-top: 20px;
    float: right;
}

.stats-refresh-btn:hover {
    background: #c73652;
    transform: scale(1.05);
}

.stats-refresh-btn:active {
    transform: scale(0.95);
}

.stats-refresh-btn.show {
    display: inline-block;
}

.stats-refresh-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.add-post-btn {
    width: 100%;
    padding: 15px;
    background: #1a1a2e;
    border: 2px dashed #e94560;
    border-radius: 15px;
    color: #e94560;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.add-post-btn:hover {
    background: #e94560;
    color: #fff;
    border-color: #fff;
    transform: scale(1.02);
}

.shop-admin h3 { color: #e94560; margin: 22px 0 10px; font-size: 16px; }
.shop-summary { padding: 14px 18px; border-radius: 12px; background: #1a1a2e; color: #ccc; }
.shop-summary b { color: #fff; }
.promo-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.promo-form input, .promo-form select { padding: 9px 10px; border-radius: 8px; border: 1px solid #ffffff22; background: #1a1a2e; color: #eee; font: inherit; }
.shop-message { color: #9be3b0; min-height: 18px; margin: 8px 0 0; }
.shop-table { width: 100%; border-collapse: collapse; font-size: 13px; display: block; overflow-x: auto; }
.shop-table th, .shop-table td { padding: 8px 10px; border-bottom: 1px solid #ffffff12; text-align: left; white-space: nowrap; }
.shop-table th { color: #909bb4; font-weight: 500; }
.shop-table tr.off td { opacity: .45; }
.shop-table button { padding: 4px 8px; font-size: 12px; margin: 0 4px 0 0; }
.shop-empty { color: #888; }
.post {
    background: #1a1a2e;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 5px solid #e94560;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.2s;
    position: relative;
}

.post:hover {
    transform: translateX(5px);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.post-title {
    color: #e94560;
    font-size: 20px;
    margin-bottom: 10px;
    flex: 1;
}

.post-text {
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 10px;
}

.post .date {
    color: #888;
    font-size: 14px;
    margin-top: 10px;
}

.post-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.post-actions button {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 8px;
    transition: all 0.3s;
    color: #888;
}

.post-actions .edit-btn:hover {
    background: rgba(233, 69, 96, 0.2);
    color: #e94560;
}

.post-actions .delete-btn:hover {
    background: rgba(192, 57, 43, 0.2);
    color: #c0392b;
}

.post-edit-area {
    display: none;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #0f3460;
}

.post-edit-area.active {
    display: block;
}

.post-edit-area input,
.post-edit-area textarea {
    width: 100%;
    background: #0f3460;
    border: 1px solid #e94560;
    color: #eee;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 16px;
}

.post-edit-area textarea {
    min-height: 100px;
    resize: vertical;
}

.post-edit-area .save-edit-btn {
    background: #e94560;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.post-edit-area .save-edit-btn:hover {
    background: #c73652;
    transform: scale(1.05);
}

.post-edit-area .cancel-edit-btn {
    background: #555;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    margin-left: 10px;
    transition: all 0.3s;
}

.post-edit-area .cancel-edit-btn:hover {
    background: #444;
}

.profile-side {
    width: 320px;
    min-width: 320px;
    background: #1a1a2e;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-left: 2px solid #0f3460;
    overflow-y: auto;
    position: relative;
}

.profile-side::-webkit-scrollbar {
    width: 5px;
}
.profile-side::-webkit-scrollbar-thumb {
    background: #e94560;
    border-radius: 10px;
}

.avatar-wrapper {
    width: 100%;
    aspect-ratio: 1/1;
    max-height: 33vh;
    position: relative;
    margin-bottom: 20px;
}

.avatar {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e94560, #0f3460);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    color: #fff;
    box-shadow: 0 8px 25px rgba(233, 69, 96, 0.3);
    overflow: hidden;
    position: relative;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar .avatar-placeholder {
    font-size: 80px;
}

.avatar-edit-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: #1a1a2e;
    border: 2px solid #e94560;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    color: #e94560;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
}

.avatar-edit-btn:hover {
    background: #e94560;
    color: #fff;
    transform: scale(1.1);
}

.profile-info {
    width: 100%;
    text-align: left;
}

.profile-info .field {
    margin-bottom: 15px;
    padding: 10px;
    background: #0f3460;
    border-radius: 10px;
    position: relative;
}

.profile-info .field label {
    display: block;
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.profile-info .field .value-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.profile-info .field .value {
    color: #eee;
    font-size: 16px;
    word-wrap: break-word;
    flex: 1;
    outline: none;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.3s;
    min-height: 24px;
}

.profile-info .field .value:focus {
    background: #1a1a2e;
    box-shadow: 0 0 0 2px #e94560;
}

.profile-info .field .value[contenteditable="true"] {
    background: #1a1a2e;
}

.field-edit-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    color: #888;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s;
    flex-shrink: 0;
    display: none;
}

.field-edit-btn:hover {
    color: #e94560;
    background: rgba(233, 69, 96, 0.1);
}

.field-edit-btn.active {
    color: #e94560;
    background: rgba(233, 69, 96, 0.2);
}

.admin-login {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #0f3460;
    width: 100%;
    text-align: center;
}

.admin-login input {
    background: #0f3460;
    border: 1px solid #e94560;
    color: #eee;
    padding: 8px 12px;
    border-radius: 8px;
    width: 100%;
    margin-bottom: 10px;
}

.admin-login input::placeholder {
    color: #666;
}

.admin-login .login-btn {
    background: #e94560;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.admin-login .login-btn:hover {
    background: #c73652;
    transform: scale(1.05);
}

.admin-status {
    color: #2ecc71;
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

.admin-status.active {
    display: block;
}

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

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #1a1a2e;
    padding: 30px;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 2px solid #e94560;
}

.modal h3 {
    color: #e94560;
    margin-bottom: 15px;
}

.modal p {
    color: #ccc;
    margin-bottom: 20px;
}

.modal .modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal .modal-buttons button {
    padding: 10px 25px;
    border: none;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.modal .modal-buttons .confirm-btn {
    background: #e94560;
    color: #fff;
}

.modal .modal-buttons .confirm-btn:hover {
    background: #c73652;
    transform: scale(1.05);
}

.modal .modal-buttons .cancel-btn {
    background: #555;
    color: #fff;
}

.modal .modal-buttons .cancel-btn:hover {
    background: #444;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #888;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column-reverse;
        height: auto;
        min-height: 100vh;
    }
    .profile-side {
        width: 100%;
        min-width: unset;
        border-left: none;
        border-bottom: 2px solid #0f3460;
        max-height: 50vh;
    }
    .avatar-wrapper {
        max-height: 30vh;
        width: 60%;
    }
    .main-content {
        padding: 15px;
    }
    .post-actions {
        flex-direction: row;
    }
    .stats-refresh-btn {
        right: 20px;
        bottom: 20px;
    }
}

/* Добавлено при выносе стилей из index.html */
[hidden] { display: none !important; }
.post-main { flex: 1; min-width: 0; }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.empty-note { text-align: center; color: #888; padding: 40px; }
.admin-login .logout-btn { background: #c0392b; margin-top: 10px; }
.new-post-form { background: #1a1a2e; padding: 20px; border-radius: 15px; margin-bottom: 20px; border: 2px solid #e94560; }
.new-post-form h3 { color: #e94560; margin-bottom: 15px; }
.new-post-form input, .new-post-form textarea { width: 100%; background: #0f3460; border: 1px solid #e94560; color: #eee; padding: 10px; border-radius: 8px; margin-bottom: 10px; font: inherit; }
.new-post-form textarea { min-height: 100px; resize: vertical; }
.new-post-form button { color: #fff; border: none; padding: 10px 25px; border-radius: 20px; cursor: pointer; font-weight: 600; margin-right: 10px; }
.new-post-form .publish-btn { background: #e94560; }
.new-post-form .secondary-btn { background: #555; }
