/* Compact Telegram Channel Manager */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f1f1f1;
    min-height: 100vh;
    padding: 0.5rem;
    color: #2d3748;
    line-height: 1.4;
    font-size: 14px;
}

.container {
    max-width: 420px;
    margin: 0 auto;
    padding: 0.4rem;
}

/* Card Styles */
.card {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 0.4rem;
    box-shadow: 3px 3px 0px rgb(0 0 0);
    margin-bottom: 0.75rem;
    border: 0.1rem solid rgb(0 0 0);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.card-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-bottom: 0.1rem solid rgb(0 0 0);
}

.card-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

.card-header i {
    margin-right: 0.5rem;
}

.card-body {
    padding: 1rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #374151;
    font-size: 0.85rem;
}

.form-group label i {
    margin-right: 0.4rem;
    width: 14px;
    color: #6b7280;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    background: #fff;
    font-family: inherit;
}

.form-group textarea {
    height: 150px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #6b7280;
    font-size: 0.75rem;
}

/* Toolbar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    border: 1px solid #e2e8f0;
}

.btn-tool {
    padding: 0.4rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
}

.btn-tool:hover {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
    transform: translateY(-1px);
}

.btn-tool.btn-secondary {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

.btn-tool.btn-secondary:hover {
    background: #4b5563;
}

.toolbar-divider {
    width: 1px;
    background: #d1d5db;
    margin: 0 0.2rem;
}

/* Form Options */
.form-options {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.8rem;
    color: #374151;
}

.checkbox input {
    width: auto;
    margin-right: 0.4rem;
    transform: scale(0.9);
}

.checkbox i {
    margin-right: 0.3rem;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Buttons */
.btn {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    justify-content: center;
}

.btn i {
    font-size: 0.8rem;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

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

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
}

/* Media Preview */
#media-preview {
    margin-top: 0.5rem;
    padding: 0.5rem;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    text-align: center;
    background: #f9fafb;
    display: none;
    font-size: 0.8rem;
}

#media-preview.has-media {
    display: block;
    border-color: #10b981;
    background: #ecfdf5;
}

.media-item {
    display: inline-block;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    max-width: 150px;
}

.media-item img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.media-info {
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Status Messages */
.success-message,
.error-message,
.info-message {
    padding: 0.6rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.success-message {
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
}

.error-message {
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fecaca;
}

.info-message {
    color: #1e40af;
    background: #dbeafe;
    border: 1px solid #93c5fd;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 0.4rem;
    max-width: 380px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 3px 3px 0px rgb(0 0 0);
    border: 0.1rem solid rgb(0 0 0);
}

.modal-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 0.4rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 0.1rem solid rgb(0 0 0);
}

.modal-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    width: 1.8rem;
    height: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 0.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

/* Preview Box */
.preview-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem;
    min-height: 80px;
    font-family: inherit;
    line-height: 1.4;
    font-size: 0.85rem;
}

.preview-box img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 0.4rem 0;
}

/* Draft Items */
.draft-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.draft-item:hover {
    border-color: #4f46e5;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.1);
}

.draft-preview {
    color: #6b7280;
    font-size: 0.8rem;
    margin: 0.4rem 0;
    max-height: 2.5rem;
    overflow: hidden;
    line-height: 1.3;
}

.draft-meta {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-bottom: 0.4rem;
}

.draft-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.draft-actions .btn {
    padding: 0.5rem 0.7rem;
    font-size: 0.75rem;
    flex: 1;
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.2rem;
    height: 1.2rem;
    margin: -0.6rem 0 0 -0.6rem;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    body {
        padding: 0.25rem;
        font-size: 13px;
    }

    .container {
        max-width: 100%;
    }

    .card-header,
    .card-body {
        padding: 0.75rem;
    }

    .toolbar {
        padding: 0.4rem;
        gap: 0.2rem;
        justify-content: center;
    }

    .btn-tool {
        width: 1.8rem;
        height: 1.8rem;
        font-size: 0.75rem;
    }

    .form-actions {
        flex-direction: row;
        gap: 0.4rem;
    }

    .form-actions .btn {
        width: 100%;
    }

    .form-options {
        flex-direction: row;
        gap: 0.4rem;
    }

    .modal {
        padding: 0.5rem;
    }

    .modal-content {
        max-height: 90vh;
    }

    .form-group input,
    .form-group textarea {
        font-size: 14px;
    }

    .draft-actions {
        flex-direction: row;
        gap: 0.4rem;
    }
}

@media (max-width: 360px) {
    .toolbar {
        flex-wrap: wrap;
        justify-content: space-around;
    }

    .btn-tool {
        width: 1.6rem;
        height: 1.6rem;
        margin: 0.1rem;
    }

    .form-group label {
        font-size: 0.8rem;
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.8rem;
    }
}

/* Animation */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hide scrollbar for webkit browsers */
.modal-body::-webkit-scrollbar {
    width: 4px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}