@import url('themes/neon.css');
@import url('themes/console.css');
@import url('themes/sunset.css');

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes popIn {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes borderGlow {
    0% { border-color: var(--accent); box-shadow: 0 0 0px var(--accent); }
    50% { border-color: #fff; box-shadow: 0 0 20px rgba(59, 130, 246, 0.4); }
    100% { border-color: var(--border); box-shadow: 0 0 0px transparent; }
}

.content-fade-out {
    opacity: 0;
    transform: scale(0.98);
    filter: blur(4px);
    transition: all 0.4s ease;
}

.post-part.saving {
    animation: borderGlow 0.8s ease-in-out;
}

#saveStatus {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent);
    color: white;
    padding: 8px 20px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

#saveStatus.show {
    transform: translateX(-50%) translateY(0);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: var(--font-main); 
    background: var(--bg); 
    color: var(--text-main); 
    min-height: 100vh; 
    padding: 24px; 
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    font-size: 15px; 
    line-height: 1.3125;
    -webkit-font-smoothing: antialiased;
}
.container { 
    max-width: 600px; 
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 601px) {
    .container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .container > form,
    .container > * {
        width: 100%;
        max-width: 600px;
    }
}

/* Ensure welcome container is visible on mobile Safari */
.container:not(.main-content) {
    min-height: 80vh;
    min-height: 80dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

header { 
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    animation: fadeIn 0.5s ease-out;
}
.header-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
h1 { 
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-main);
}
.nav { 
    display: flex; 
    gap: 32px; 
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.25em;
}
.nav a { 
    color: var(--text-dim); 
    text-decoration: none; 
    transition: color 0.2s;
}
.nav a:hover { color: var(--text-main); }
.nav a.active { color: var(--text-main); }

.main-content {
    padding-top: 100px;
    padding-bottom: 60px;
}

.btn { 
    display: inline-block;
    background: var(--btn-bg);
    background-size: 200% 100%;
    color: var(--btn-text);
    padding: 14px 40px; 
    border-radius: 99px; 
    text-decoration: none; 
    font-weight: 800; 
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1); 
    border: none;
    cursor: pointer;
    animation: shimmer 5s infinite linear;
}
.btn:hover { 
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 30px rgba(255,255,255,0.1);
}
.btn:disabled { 
    background: #475569; 
    color: #94A3B8; 
    cursor: not-allowed; 
    transform: none; 
    box-shadow: none;
    animation: none;
}

.btn-secondary { 
    background: transparent; 
    color: var(--text-dim);
    border: none;
    box-shadow: none;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    padding: 10px 20px;
    animation: none;
}
.btn-secondary:hover { 
    color: var(--text-main);
    transform: none;
    box-shadow: none;
}

.btn-danger { 
    background: #f4212e20; 
    color: #f4212e; 
    border: 1px solid #f4212e; 
}
.btn-danger:hover { background: #f4212e40; }

.empty-state { 
    text-align: center; 
    padding: 80px 32px; 
    color: var(--text-dim); 
    background: var(--card); 
    border-radius: 28px;
    border: 1px solid var(--border);
    animation: popIn 0.6s ease-out;
}

.empty-state .empty-icon { 
    font-size: 4rem; 
    margin-bottom: 24px; 
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 1rem;
    line-height: 1.6;
}

.empty-state a { 
    color: var(--accent); 
    text-decoration: none; 
    font-weight: 500;
}
.empty-state a:hover { 
    text-decoration: underline; 
}

.card { 
    background: var(--card); 
    border-radius: 20px; 
    padding: 24px; 
    margin-bottom: 24px; 
    border: 1px solid var(--border);
}

.welcome-container { 
    text-align: center; 
    padding: 60px 32px;
    background: var(--card);
    border-radius: 28px;
    margin-top: 40px;
    border: 1px solid var(--border);
    animation: popIn 0.6s ease-out;
}
.welcome-title { 
    font-size: 2rem; 
    margin-bottom: 1rem; 
    color: var(--text-main);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.welcome-description { 
    color: var(--text-dim); 
    margin-bottom: 2rem; 
    font-size: 16px;
    line-height: 1.6;
}
.logged-in-status { 
    color: var(--accent); 
    margin-bottom: 1.5rem; 
    font-weight: 600;
    font-size: 14px;
}
.welcome-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}
.welcome-buttons .btn {
    min-width: 260px;
    width: 260px;
    text-align: center;
    white-space: nowrap;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state a { color: #1d9bf0; text-decoration: none; }
.empty-state a:hover { text-decoration: underline; }

.icon-img { width: 16px; height: 16px; }

input, select, textarea { font-size: 16px; }

@media (max-width: 600px) {
    body { padding: 12px; }

    /* Ensure welcome container is visible and centered on mobile */
    .container:not(.main-content) {
        min-height: 80vh;
        min-height: 80dvh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .welcome-container {
        margin-top: 0;
        width: 100%;
        max-width: 100%;
    }

    header { 
        flex-direction: column; 
        gap: 16px; 
        align-items: flex-start; 
    }
    .nav { 
        flex-wrap: wrap; 
        gap: 12px; 
    }
    .btn {
        padding: 8px 16px;
        font-size: 13px;
        border-radius: 8px;
    }
    .welcome-buttons .btn {
        min-width: 200px;
        width: 200px;
        padding: 10px 20px;
    }
    .platforms {
        gap: 10px;
    }
    .platform-checkbox {
        width: 38px;
        height: 38px;
    }
    .platform-icon {
        width: 20px;
        height: 20px;
    }
    .footer {
        flex-direction: column;
        align-items: center;
        gap: 24px;
    }
}

/* Post styles */
.post { 
    background: #1E293B; 
    border-radius: 16px; 
    margin-bottom: 24px; 
    overflow: hidden; 
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #334155;
}
.post-body { padding: 24px; }
.post-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 16px; 
}
.post-meta { 
    font-size: 0.9rem; 
    color: #94A3B8; 
    display: flex;
    align-items: center;
    gap: 12px;
}
.post-content { 
    white-space: pre-wrap; 
    word-break: break-word; 
    font-size: 16px; 
    line-height: 1.6; 
    color: #F1F5F9;
}

/* Draft styles */
.draft-item { 
    background: #1E293B; 
    border-radius: 16px; 
    overflow: hidden; 
    transition: all 0.2s; 
    border: 1px solid #334155;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}
.draft-item:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.draft-body { padding: 24px; }
.draft-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 16px; 
}
.draft-time { color: #94A3B8; font-size: 0.9rem; }
.draft-preview { 
    color: #F1F5F9; 
    font-size: 16px; 
    line-height: 1.6; 
    white-space: pre-wrap; 
    word-break: break-word; 
}

/* Form styles - Post Card */
.post-part { 
    position: relative;
    background: var(--card); 
    border-radius: 28px; 
    padding: 32px; 
    border: 1px solid var(--border);
    margin-bottom: 24px;
    transition: all 0.5s cubic-bezier(0.2, 1, 0.3, 1);
    animation: popIn 0.6s cubic-bezier(0.2, 1, 0.3, 1) backwards;
    width: 100%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.post-part:focus-within {
    border-color: rgba(59, 130, 246, 0.4);
}

#posts-container {
    width: 100%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Thread connector line */
.post-part.has-next::after {
    content: '';
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 24px;
    background: linear-gradient(to bottom, var(--accent), transparent);
}

.post-part-textarea { 
    width: 100%; 
    min-height: 100px; 
    background: transparent; 
    border: none; 
    color: var(--text-main); 
    font-size: 1.1rem; 
    resize: none; 
    outline: none;
    margin-top: 16px;
    line-height: 1.6;
    font-family: inherit;
}
.post-part-textarea::placeholder { color: #334155; }

/* Platform selector */
.platforms { 
    display: flex; 
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px; 
    margin-bottom: 0;
    padding: 4px 0;
    background: transparent;
    align-items: flex-start;
}

.platform-checkbox { 
    cursor: pointer; 
    transition: all 0.3s ease;
}
.platform-checkbox input { display: none; }

.platform-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: rgba(255,255,255,0.02);
    filter: grayscale(1);
    opacity: 0.3;
}

.platform-checkbox:hover .platform-circle {
    opacity: 0.6;
}

.platform-checkbox:has(input:checked) .platform-circle {
    opacity: 1;
    filter: grayscale(0);
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.platform-icon { 
    width: 20px; 
    height: 20px; 
    border-radius: 4px; 
}

/* Светлые иконки соцсетей в темной теме */
:root .platform-icon,
:root .reply-platform-icon,
:root .platform-badge img,
:root .platform-tag img,
:root .platform-stat-icon,
:root .empty-icon img,
:root .stat-value-small img,
:root .account-icon img,
:root .result-left img,
[data-theme="neon-dark"] .platform-icon,
[data-theme="neon-dark"] .reply-platform-icon,
[data-theme="neon-dark"] .platform-badge img,
[data-theme="neon-dark"] .platform-tag img,
[data-theme="neon-dark"] .platform-stat-icon,
[data-theme="neon-dark"] .empty-icon img,
[data-theme="neon-dark"] .stat-value-small img,
[data-theme="neon-dark"] .account-icon img,
[data-theme="neon-dark"] .result-left img,
[data-theme="console"] .platform-icon,
[data-theme="console"] .reply-platform-icon,
[data-theme="console"] .platform-badge img,
[data-theme="console"] .platform-tag img,
[data-theme="console"] .platform-stat-icon,
[data-theme="console"] .empty-icon img,
[data-theme="console"] .stat-value-small img,
[data-theme="console"] .account-icon img,
[data-theme="console"] .result-left img,
[data-theme="sunset"] .platform-icon,
[data-theme="sunset"] .reply-platform-icon,
[data-theme="sunset"] .platform-badge img,
[data-theme="sunset"] .platform-tag img,
[data-theme="sunset"] .platform-stat-icon,
[data-theme="sunset"] .empty-icon img,
[data-theme="sunset"] .stat-value-small img,
[data-theme="sunset"] .account-icon img,
[data-theme="sunset"] .result-left img {
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

/* Темные иконки в светлых темах */
[data-theme="neon-light"] .platform-icon,
[data-theme="neon-light"] .reply-platform-icon,
[data-theme="neon-light"] .platform-badge img,
[data-theme="neon-light"] .platform-tag img,
[data-theme="neon-light"] .platform-stat-icon,
[data-theme="neon-light"] .empty-icon img,
[data-theme="neon-light"] .stat-value-small img,
[data-theme="neon-light"] .account-icon img,
[data-theme="neon-light"] .result-left img,
[data-theme="sunset-light"] .platform-icon,
[data-theme="sunset-light"] .reply-platform-icon,
[data-theme="sunset-light"] .platform-badge img,
[data-theme="sunset-light"] .platform-tag img,
[data-theme="sunset-light"] .platform-stat-icon,
[data-theme="sunset-light"] .empty-icon img,
[data-theme="sunset-light"] .stat-value-small img,
[data-theme="sunset-light"] .account-icon img,
[data-theme="sunset-light"] .result-left img,
[data-theme="console-light"] .platform-icon,
[data-theme="console-light"] .reply-platform-icon,
[data-theme="console-light"] .platform-badge img,
[data-theme="console-light"] .platform-tag img,
[data-theme="console-light"] .platform-stat-icon,
[data-theme="console-light"] .empty-icon img,
[data-theme="console-light"] .stat-value-small img,
[data-theme="console-light"] .account-icon img,
[data-theme="console-light"] .result-left img {
    filter: brightness(0);
    opacity: 0.8;
}

.platform-counter {
    font-size: 9px;
    font-weight: 400;
    color: var(--text-dim);
    display: none;
    font-variant-numeric: tabular-nums;
    text-align: center;
    line-height: 1;
    white-space: nowrap;
    margin-top: 6px;
}

.platform-checkbox:has(input:checked) .platform-counter {
    display: block;
    color: var(--accent);
}

.no-platforms { 
    color: #8899a6; 
    padding: 16px; 
    background: #192734; 
    border-radius: 8px;
    text-align: center;
}
.no-platforms a { color: #1d9bf0; text-decoration: none; }
.no-platforms a:hover { text-decoration: underline; }

/* Thread styles */
.thread-parts { border-top: 1px solid #38444d; }
.thread-part { padding: 12px 16px; border-bottom: 1px solid #38444d; }
.thread-part:last-child { border-bottom: none; }
.thread-part-content { 
    color: #d9d9d9; 
    font-size: 14px; 
    line-height: 1.4; 
    white-space: pre-wrap; 
    word-break: break-word; 
}

/* Badge styles */
.thread-badge { 
    background: #1d9bf020; 
    color: #1d9bf0; 
    padding: 2px 8px; 
    border-radius: 12px; 
    font-size: 0.75rem; 
    font-weight: 500; 
}

/* Platform icon styles */
.platform-icons { 
    display: flex; 
    gap: 8px; 
    align-items: center;
}
.platform-icon { 
    width: 24px; 
    height: 24px; 
    border-radius: 6px; 
}
.platform-icon.large { 
    width: 32px; 
    height: 32px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    background: #334155; 
    border-radius: 8px;
    transition: all 0.2s;
}
.platform-icon.large.success { 
    background: #10B981; 
    box-shadow: 0 0 0 2px #10B98120;
}
.platform-icon.large.error { 
    background: #EF4444; 
    opacity: 0.7; 
}
.platform-icon.large.pending { 
    background: #F59E0B; 
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Reply context */
.reply-context { 
    background: var(--card); 
    border-radius: 20px; 
    padding: 20px 24px; 
    margin-bottom: 24px; 
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
}
.reply-label { 
    font-size: 10px; 
    font-weight: 700;
    color: var(--text-dim); 
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px; 
}
.reply-preview { 
    font-size: 15px; 
    color: var(--text-main); 
    white-space: pre-wrap; 
    word-break: break-word;
    line-height: 1.5;
}
.reply-platforms {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.reply-platform-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    opacity: 0.8;
}
/* Profile styles */
.section-title { 
    font-size: 1.1rem; 
    margin-bottom: 16px; 
    color: #8899a6; 
}
.accounts { 
    padding: 16px; 
    background: #192734; 
    border-radius: 12px; 
}
.account { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 16px; 
    padding-bottom: 16px; 
    border-bottom: 1px solid #38444d; 
    transition: opacity 0.3s ease; 
}
.account:last-child { 
    margin-bottom: 0; 
    padding-bottom: 0; 
    border-bottom: none; 
}
.account-icon { 
    width: 32px; 
    font-size: 1.5rem; 
    text-align: center; 
}
.account-name { flex: 1; }
.connected { color: #00ba7c; }
.not-connected { color: #8899a6; }
.input-field { 
    flex: 1; 
    padding: 8px 12px; 
    border-radius: 8px; 
    border: 1px solid #38444d; 
    background: #15202b; 
    color: #fff; 
    font-size: 16px; 
}
.htmx-swapping { opacity: 0; }
.btn-mastodon { background: #6364ff; }
.btn-mastodon:hover { background: #5253e0; }
.btn-threads { background: #000; border: 1px solid #fff; }
.btn-threads:hover { background: #333; }
.btn-bluesky { background: #0085ff; }
.btn-bluesky:hover { background: #0070dd; }
.btn-linkedin { background: #0077b5; }
.btn-linkedin:hover { background: #005885; }
.btn-telegram { background: #0088cc; }
.btn-telegram:hover { background: #006699; }
.btn-google { background: var(--btn-bg); }
.btn-google:hover { 
    background: #EA4335;
    box-shadow: 0 10px 30px rgba(234, 67, 53, 0.3);
}

.btn-x { background: var(--btn-bg); }
.btn-x:hover { 
    background: #000;
    color: #fff;
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.15);
}
.btn-disconnect { 
    background: transparent; 
    color: #f4212e; 
    border: 1px solid #f4212e; 
    padding: 6px 12px; 
    font-size: 0.85rem; 
    margin-left: auto; 
}
.btn-disconnect:hover { background: #f4212e; color: #fff; }

/* Form styles */
.form-group { margin-bottom: 16px; }
label { display: block; margin-bottom: 6px; color: #8899a6; }
input[type="text"], textarea { 
    width: 100%; 
    background: #192734; 
    border: 1px solid #38444d; 
    border-radius: 8px; 
    padding: 12px; 
    color: #fff; 
    font-size: 1rem; 
}
input[type="text"]:focus, textarea:focus { outline: none; border-color: #1d9bf0; }
textarea { 
    height: 200px; 
    resize: vertical; 
    font-family: inherit; 
    font-size: 16px; 
    line-height: 1.3125; 
}

.btn-primary { background: #1d9bf0; color: #fff; }
.btn-primary:hover { background: #1a8cd8; }

.actions { display: flex; gap: 12px; margin-top: 20px; }
.image-upload { margin-bottom: 8px; }
.upload-label { 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    cursor: pointer; 
    padding: 10px 16px; 
    background: #192734; 
    border: 1px dashed #38444d; 
    border-radius: 8px; 
    transition: border-color 0.2s; 
}
.upload-label:hover { border-color: #1d9bf0; }
.existing-images, #image-preview { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
    margin-top: 8px; 
}
.preview-img { 
    max-width: 120px; 
    max-height: 120px; 
    border-radius: 8px; 
    object-fit: cover; 
}

/* Error page styles */
.error-container { 
    max-width: 400px; 
    padding: 40px; 
    text-align: center; 
    background: #192734; 
    border-radius: 12px; 
}
.error-title { color: #f4212e; margin-bottom: 1rem; font-size: 1.5rem; }
.error-message { color: #8899a6; margin-bottom: 2rem; word-break: break-word; }
/* Post part header styles */
.post-part-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 4px; 
}
.post-part-label { 
    font-size: 9px;
    font-weight: 900;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    background: rgba(255,255,255,0.05);
    padding: 6px 12px;
    border-radius: 99px;
}
.post-part-remove { 
    background: transparent; 
    color: var(--text-dim);
    border: none; 
    width: 28px; 
    height: 28px; 
    cursor: pointer; 
    font-size: 14px; 
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: rgba(255,255,255,0.03);
}
.post-part-remove:hover { 
    color: #ef4444; 
    background: rgba(239, 68, 68, 0.1); 
}
/* Post part footer styles */
.post-part-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.post-part-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-part-image-preview { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.post-part-image-preview:not(:has(.media-item)) {
    display: flex;
}

.media-add-mobile { display: none !important; }
.media-add-desktop { display: flex; }

/* Media add button */
.media-add-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    transition: all 0.3s;
    cursor: pointer;
    background: transparent;
    flex-shrink: 0;
}
.media-add-btn:hover { 
    border-color: var(--accent); 
    color: var(--accent);
    background: rgba(59, 130, 246, 0.05);
}
.media-add-btn svg {
    width: 20px;
    height: 20px;
}

/* Media item in preview */
.media-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
}
.media-item:hover { transform: scale(1.03); }
.media-item img,
.media-item video { width: 100%; height: 100%; object-fit: cover; }
.media-item .remove-media-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}
.media-item .remove-media-btn:hover { background: #ef4444; }

/* Resize notification */
.resize-notification {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    font-size: 13px;
    color: #f59e0b;
    margin-top: 8px;
}
.resize-notification span {
    font-size: 14px;
}
.media-item.will-resize {
    border-color: rgba(245, 158, 11, 0.5);
}
.media-item.will-resize::after {
    content: '⚏';
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
}

/* Ring Progress Indicator */
.progress-ring {
    width: 24px;
    height: 24px;
    transform: rotate(-90deg);
}
.progress-ring circle {
    fill: transparent;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease, stroke 0.3s ease;
}
.progress-bg { stroke: rgba(255,255,255,0.05); }
.progress-bar { stroke: var(--accent); stroke-dasharray: 69; stroke-dashoffset: 69; }

.post-part-counter { 
    color: var(--text-dim); 
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-left: 8px;
}

.post-part-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-part-btn { 
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}
.add-part-btn:hover { 
    color: #60a5fa;
}
.add-part-btn .add-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.add-part-btn .add-icon svg {
    width: 12px;
    height: 12px;
}
/* Footer styles */
.footer {
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    width: 100%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.platforms-section {
    text-align: center;
}

.platforms-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5em;
    color: #334155;
    font-weight: 900;
    margin-bottom: 24px;
}



/* Keyboard shortcut hint */
.kbd-hint {
    font-size: 10px;
    font-family: monospace;
    padding: 2px 6px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    color: var(--text-dim);
    margin-left: 8px;
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-success { color: #10B981; }
.status-error { color: #EF4444; }
.status-pending { color: #F59E0B; }

/* Technical logs */
.logs-toggle {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 10px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}
.logs-toggle:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
}

.technical-logs {
    margin-top: 16px;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    font-family: monospace;
    font-size: 11px;
    color: var(--text-dim);
    display: none;
}
.technical-logs.show { display: block; }

/* Smart counter */
.smart-counter {
    display: none;
}

/* Results styles */
.results { 
    margin-top: 32px;
    animation: fadeIn 0.5s ease-out;
}
.result-item { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    padding: 16px 20px; 
    border-radius: 16px; 
    margin-bottom: 12px;
    background: var(--card);
    border: 1px solid var(--border);
}
.result-item.pending { 
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}
.result-item.success { 
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}
.result-item.error { 
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}
.result-icon { 
    font-size: 1.2rem; 
    font-weight: bold;
    line-height: 1;
}
.result-text { 
    flex: 1; 
    font-size: 14px;
    color: var(--text-main);
}
.result-text a { 
    color: var(--accent); 
    text-decoration: none;
    font-weight: 600;
}
.result-text a:hover { text-decoration: underline; }

/* Spinner */
.spinner { 
    animation: spin 1s linear infinite; 
    display: inline-block;
}
@keyframes spin { 
    from { transform: rotate(0deg); } 
    to { transform: rotate(360deg); } 
}

.htmx-request .btn { 
    opacity: 0.7; 
    pointer-events: none;
}
.htmx-swapping { opacity: 0; }

/* Mobile adjustments */
@media (max-width: 600px) {
    body { padding: 12px; padding-bottom: 24px; }
    
    header { padding: 12px 0; }
    .header-content { 
        padding: 0 12px; 
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    h1 { font-size: 1rem; }
    .nav { 
        width: 100%;
        justify-content: space-between;
        gap: 0;
        font-size: 9px; 
    }
    .main-content { padding-top: 100px; padding-bottom: 40px; }
    
    .post-part {
        padding: 16px;
        border-radius: 16px;
    }
    
    .post-part-textarea {
        font-size: 16px;
        min-height: 180px;
        line-height: 1.5;
        margin-top: 8px;
    }
    
    .post-part-footer {
        flex-direction: row;
        justify-content: space-between;
        gap: 12px;
        align-items: center;
    }
    
    .post-part-left {
        order: 1;
        justify-content: flex-start;
    }
    
    .add-part-btn {
        order: 2;
        width: auto;
        padding: 10px 14px;
        background: rgba(59, 130, 246, 0.1);
        border-radius: 10px;
    }
    .add-part-btn span { display: none; }
    .add-part-btn .add-icon { 
        width: 20px; 
        height: 20px; 
    }
    
    .footer {
        margin-top: 32px;
        gap: 24px;
    }
    
    .platforms { gap: 12px; }
    .platform-circle { width: 48px; height: 48px; }
    .platform-icon { width: 24px; height: 24px; }
    .platform-counter { font-size: 10px; }
    
    .kbd-hint { display: none; }
    
    .post-part-image-preview {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
        margin-top: 12px;
    }
    
    .post-part-image-preview:not(:has(.media-item)) {
        display: none;
    }
    
    .media-add-desktop { display: none !important; }
    .media-add-mobile { 
        display: flex !important;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        border: none;
        background: rgba(255,255,255,0.05);
    }
    
    .post-part-remove {
        width: 36px;
        height: 36px;
    }
    
    .result-item {
        padding: 12px 16px;
        border-radius: 12px;
    }
    
    #saveStatus {
        bottom: 20px;
        padding: 12px 24px;
        font-size: 13px;
    }
}

/* Touch device optimizations */
@media (pointer: coarse) {
    .platform-circle {
        width: 48px;
        height: 48px;
    }
    
    .platform-icon {
        width: 24px;
        height: 24px;
    }
    
    .media-add-btn {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }
    
    .post-part-remove {
        width: 44px;
        height: 44px;
    }
    
    .add-part-btn {
        min-height: 44px;
    }
    
    .btn {
        min-height: 48px;
    }
    
    .nav a {
        padding: 8px 4px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .media-item .remove-media-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* Small phones */
@media (max-width: 380px) {
    body { padding: 8px; }
    
    .post-part { padding: 12px; }
    
    .platforms { gap: 12px; }
    .platform-circle { width: 44px; height: 44px; }
    
    .nav { gap: 10px; font-size: 8px; }
    
    h1 { font-size: 1rem; }
}
/* Schedule Modal */
.schedule-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.schedule-modal-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    animation: popIn 0.3s ease-out;
}

.schedule-modal h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-main);
}

.schedule-modal input[type="datetime-local"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 14px;
    margin-bottom: 20px;
}

.schedule-modal input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--accent);
}

.schedule-modal-actions {
    display: flex;
    gap: 12px;
}

.schedule-modal-actions .btn {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

/* Обновленный контейнер кнопок */
.footer-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

/* Группа основных действий (Публикация + Таймер) */
.action-group {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 400px;
}

/* Основная кнопка (Publish) */
.btn-primary-glow {
    flex: 1;
    background: var(--btn-bg);
    background-size: 200% 100%;
    color: var(--btn-text);
    padding: 14px 24px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    animation: shimmer 5s infinite linear;
    transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-primary-glow:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 10px 30px rgba(255,255,255,0.15);
}

/* Кнопка-иконка (Schedule) */
.btn-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    animation: none;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-icon svg {
    width: 24px;
    height: 24px;
}

/* Второстепенная кнопка (Save Draft) */
.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 99px;
    transition: all 0.2s;
    opacity: 0.7;
}

.btn-ghost:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

/* Мобильная адаптация */
@media (max-width: 600px) {
    .action-group {
        gap: 8px;
    }
    
    .btn-primary-glow {
        padding: 14px 20px;
        font-size: 14px;
        border-radius: 16px;
    }
    
    .btn-icon {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }
    
    .schedule-modal-content {
        margin: 0 16px;
    }
}
#schedule-btn.scheduled {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

#submit.scheduled {
    background: var(--accent);
    color: white;
}
/* Стили для превышения лимитов символов */
.part-exceeded .post-part-textarea {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 1px #ef4444 !important;
}

.part-exceeded .post-part-counter {
    color: #ef4444 !important;
    font-weight: 600;
}

.btn-primary-glow.disabled-exceeded {
    background: #ef4444 !important;
    cursor: not-allowed !important;
    opacity: 0.7;
    animation: none !important;
}

.btn-primary-glow.disabled-exceeded:hover {
    transform: none !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3) !important;
}

.platform-counter {
    transition: all 0.2s ease;
}

.platform-checkbox:has(input:checked) .platform-counter {
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: 600;
}
.platform-checkbox:has(input:checked) .platform-counter {
    background: transparent !important;
}