/* CopyPasta Web Client Styles */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a25;
    --bg-elevated: #22222f;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

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

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

#app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Screens */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.screen.hidden,
.hidden {
    display: none !important;
}

/* Loading Screen */
#loading-screen {
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Auth Screen */
.auth-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 24px;
}

.logo {
    font-size: 64px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.auth-container h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    text-align: center;
}

/* Selected Emojis Display */
.selected-emojis {
    display: flex;
    gap: 12px;
    margin: 20px 0;
}

.emoji-slot {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.emoji-slot.filled {
    border-color: var(--accent);
    background: var(--bg-elevated);
    animation: pop 0.2s ease-out;
}

@keyframes pop {
    0% {
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Emoji Grid */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    max-width: 320px;
    margin: 0 auto;
}

.emoji-btn {
    width: 56px;
    height: 56px;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.emoji-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
    transform: scale(1.05);
}

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

.emoji-btn.active {
    background: var(--accent);
    color: white;
    transform: scale(0.9);
}

/* Auth Actions */
.auth-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-elevated);
}

/* Auth Message */
.auth-message {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 14px;
}

.auth-message.info {
    color: var(--accent);
    background: rgba(14, 165, 233, 0.1);
}

.auth-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.auth-message.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Lockout Timer */
.lockout-timer {
    text-align: center;
    color: var(--warning);
    font-weight: 500;
    padding: 16px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-small {
    font-size: 28px;
}

.header h2 {
    font-size: 18px;
    font-weight: 600;
}

.status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

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

.status.online .status-dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

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

/* Clip List */
.clip-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Clip Card */
.clip-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    transition: var(--transition);
    cursor: pointer;
}

.clip-card.deleting {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    margin-bottom: -70px;
    /* Collapse space */
    pointer-events: none;
}

.clip-card:hover {
    border-color: var(--accent);
    background: var(--bg-elevated);
}

.clip-content {
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    max-height: 120px;
    overflow: hidden;
    position: relative;
}

.clip-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--bg-card));
    pointer-events: none;
}

.clip-card:hover .clip-content::after {
    background: linear-gradient(transparent, var(--bg-elevated));
}

.clip-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

.clip-type {
    display: flex;
    align-items: center;
    gap: 6px;
}

.clip-actions {
    display: flex;
    gap: 8px;
    position: relative;
    z-index: 10;
}

.clip-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    transition: var(--transition);
}

.clip-action-btn:hover {
    background: var(--bg-elevated);
    color: var(--accent);
}

/* Image Preview */
.clip-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

/* Add Panel */
.add-panel {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    margin-top: auto;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 16px;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.drop-icon {
    font-size: 32px;
}

.add-text {
    display: flex;
    gap: 12px;
}

.add-text textarea {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    min-height: 60px;
    transition: var(--transition);
}

.add-text textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.add-text textarea::placeholder {
    color: var(--text-muted);
}

/* Error Screens */
.error-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    gap: 16px;
}

.error-icon {
    font-size: 64px;
    margin-bottom: 8px;
}

.error-container h2 {
    font-size: 24px;
    font-weight: 600;
}

.error-container p {
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 480px) {
    .emoji-grid {
        gap: 8px;
    }

    .emoji-btn {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .emoji-slot {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .selected-emojis {
        gap: 8px;
    }
}