/* ============================================
   LinkSnip - Clean Professional Design
   ============================================ */

:root {
    --primary: #0066CC;
    --primary-hover: #0052A3;
    --bg-page: #F5F7FA;
    --bg-card: #FFFFFF;
    --bg-input: #F0F2F5;
    --border: #E1E4E8;
    --text-dark: #1A1A1A;
    --text-medium: #4A4A4A;
    --text-light: #6B7280;
    --success: #10B981;
    --error: #EF4444;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-page);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

/* Layout */
.app-container {
    max-width: 580px;
    margin: 0 auto;
    padding: 24px 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.logo h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
}

.status-dot.connected {
    background: var(--success);
}

.status-dot.error {
    background: var(--error);
}

.status-text {
    color: var(--text-medium);
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 32px 16px;
    margin-bottom: 20px;
}

.hero-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 16px;
    color: var(--text-medium);
    max-width: 400px;
    margin: 0 auto 24px;
    line-height: 1.5;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-medium);
}

.feature-icon {
    font-size: 18px;
}

/* Info Section (How It Works) */
.info-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 16px;
    text-align: center;
}

.info-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 20px;
}

.steps {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 120px;
}

.step-num {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.step p {
    font-size: 13px;
    color: var(--text-medium);
    text-align: center;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card-header {
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.card-header .subtitle {
    font-size: 14px;
    color: var(--text-light);
}

/* Info Box */
.info-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    text-align: center;
}

.info-box p {
    color: var(--text-medium);
    font-size: 14px;
    margin-bottom: 10px;
}

.info-box code {
    display: inline-block;
    background: var(--text-dark);
    color: #10B981;
    padding: 8px 16px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 14px;
}

/* Forms */
.form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-medium);
}

.form-group input {
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.form-group input::placeholder {
    color: var(--text-light);
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group input {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white !important;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    background: #94A3B8;
    cursor: not-allowed;
}

.btn-primary span,
.btn-primary .btn-text {
    color: white !important;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-medium);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #E5E7EB;
}

.btn-text {
    background: transparent;
    color: var(--text-light);
    padding: 6px 12px;
}

.btn-text:hover {
    color: var(--primary);
}

.btn-copy {
    background: var(--bg-input);
    color: var(--text-dark);
    border: 1px solid var(--border);
    min-width: 70px;
}

.btn-copy:hover {
    background: #E5E7EB;
}

.btn-copy.copied {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-telegram {
    background: #0088cc;
    color: white !important;
    text-decoration: none;
    margin-top: 16px;
    padding: 12px 24px;
    font-size: 14px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-telegram:hover {
    background: #006699;
}

.button-row {
    display: flex;
    gap: 10px;
}

.button-row .btn {
    flex: 1;
}

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Progress */
.progress-box {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-input);
    border-radius: 6px;
}

.progress-track {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s;
}

.progress-label {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-light);
    text-align: center;
}

#countdown {
    font-weight: 600;
    color: var(--text-dark);
}

/* Result */
.result-box {
    margin-top: 20px;
    padding: 16px;
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    border-radius: 6px;
}

.result-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #059669;
}

.icon-check {
    width: 20px;
    height: 20px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.result-row {
    display: flex;
    gap: 8px;
}

.result-row input {
    flex: 1;
    padding: 10px 12px;
    background: white;
    border: 1px solid #A7F3D0;
    border-radius: 6px;
    font-size: 14px;
    font-family: monospace;
    color: var(--text-dark);
}

/* Error */
.error-box {
    margin-top: 20px;
    padding: 14px 16px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #DC2626;
}

.icon-error {
    width: 20px;
    height: 20px;
    background: var(--error);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-input);
    border-radius: 6px;
}

.history-urls {
    flex: 1;
    min-width: 0;
}

.history-original {
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.history-short {
    font-size: 14px;
    color: var(--primary);
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-copy {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 6px;
}

.history-copy:hover {
    color: var(--primary);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--text-dark);
    color: white;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 8px;
    animation: slideUp 0.3s ease;
}

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

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--error);
}

/* Footer */
.footer {
    margin-top: auto;
    padding-top: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .result-row {
        flex-direction: column;
    }
    
    .toast-container {
        left: 16px;
        right: 16px;
    }
}
