/* Reset và base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);
    color: white;
    padding: 30px;
    text-align: center;
    border-bottom: 5px solid #3a56a4;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}

/* Main content layout */
main {
    padding: 30px;
}

.app-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 1100px) {
    .app-container {
        grid-template-columns: 1fr;
    }
}

/* Input section */
.input-section, .results-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 1rem;
}

.input-with-button {
    display: flex;
    gap: 10px;
}

input, textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: white;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #4b6cb7;
    box-shadow: 0 0 0 3px rgba(75, 108, 183, 0.2);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.icon-btn {
    background: #4b6cb7;
    color: white;
    border: none;
    border-radius: 10px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: #3a56a4;
    transform: translateY(-2px);
}

/* Social selector */
.social-selector {
    background: white;
    border-radius: 10px;
    padding: 20px;
    border: 2px solid #eaeaea;
}

.select-all-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.btn-select-all, .btn-deselect-all {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: #f1f1f1;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-select-all:hover {
    background: #4CAF50;
    color: white;
}

.btn-deselect-all:hover {
    background: #f44336;
    color: white;
}

.social-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

.social-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.social-option:hover {
    background: #eef2ff;
    transform: translateY(-2px);
}

.social-option.selected {
    background: #e3f2fd;
    border-color: #4b6cb7;
}

.social-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.social-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.social-name {
    font-weight: 600;
    color: #333;
}

/* Actions */
.actions {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.btn-primary, .btn-secondary {
    padding: 16px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(90deg, #4b6cb7 0%, #3a56a4 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(90deg, #3a56a4 0%, #2c458f 100%);
    transform: translateY(-3px);
    box-shadow: 0 7px 15px rgba(75, 108, 183, 0.4);
}

.btn-secondary {
    background: #f1f1f1;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
    transform: translateY(-3px);
}

/* Results section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2c3e50;
    font-size: 1.5rem;
}

.btn-copy-all {
    padding: 12px 25px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-copy-all:hover {
    background: #388E3C;
    transform: translateY(-2px);
}

.results-container {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    background: white;
    border-radius: 10px;
    padding: 20px;
    border: 2px solid #eaeaea;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 250px;
    color: #888;
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #ccc;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 5px solid;
    transition: all 0.3s ease;
}

.result-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.result-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
}

.result-link {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #2c3e50;
    font-weight: 500;
    text-decoration: none;
}

.result-link:hover {
    color: #4b6cb7;
    text-decoration: underline;
}

.copy-btn {
    padding: 10px 18px;
    background: #4b6cb7;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.copy-btn:hover {
    background: #3a56a4;
    transform: translateY(-2px);
}

/* Statistics */
.statistics {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #eaeaea;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-label {
    font-weight: 600;
    color: #555;
}

.stat-value {
    background: #4b6cb7;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
}

/* Social preview */
.social-preview {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
    margin-top: 20px;
}

.social-preview h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.preview-container {
    display: flex;
    justify-content: center;
}

.preview-card {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #ddd;
}

.preview-header {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.preview-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #4b6cb7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    margin-right: 15px;
}

.preview-user {
    flex: 1;
}

.preview-username {
    font-weight: 700;
    color: #333;
}

.preview-time {
    font-size: 0.9rem;
    color: #888;
}

.preview-social-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #4267B2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.preview-content {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.preview-link {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin: 15px;
}

.preview-link-image {
    width: 100px;
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
    flex-shrink: 0;
}

.preview-link-info {
    padding: 15px;
    flex: 1;
}

.preview-link-title {
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.preview-link-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 5px;
    line-height: 1.4;
}

.preview-link-domain {
    color: #888;
    font-size: 0.85rem;
}

.preview-actions {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    border-top: 1px solid #eee;
}

.preview-action {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
}

.preview-action:hover {
    color: #4b6cb7;
}

/* Footer */
footer {
    background: #2c3e50;
    color: white;
    padding: 25px 30px;
    border-top: 5px solid #4b6cb7;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-info p {
    margin-bottom: 5px;
}

.footer-credits {
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-links {
    display: flex;
    gap: 25px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #4b6cb7;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 25px;
}

.modal-body h3 {
    margin: 20px 0 10px;
    color: #2c3e50;
}

.modal-body ol, .modal-body ul {
    padding-left: 20px;
    margin-bottom: 20px;
}

.modal-body li {
    margin-bottom: 10px;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #4CAF50;
    color: white;
    padding: 18px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 1001;
    font-weight: 600;
    animation: fadeInOut 3s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(20px); }
    15% { opacity: 1; transform: translateY(0); }
    85% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(20px); }
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 10px;
    }
    
    .app-container {
        padding: 15px;
    }
    
    .input-section, .results-section {
        padding: 20px;
    }
    
    .social-checkboxes {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .actions {
        flex-direction: column;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    main {
        padding: 20px 15px;
    }
    
    .social-checkboxes {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .btn-copy-all {
        width: 100%;
        justify-content: center;
    }
}