/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --success: #4ade80;
    --error: #ef4444;
    --border: #2a2a4a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important;
}

/* App Container */
.app {
    width: 400px;
    min-height: 500px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Title Bar */
.title-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    user-select: none;
}

.title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Content Area */
.content {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

/* State Views */
.state-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

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

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

.status-text {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Code Section */
.code-section {
    width: 100%;
    text-align: center;
    margin-bottom: 24px;
}

.label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.code-display {
    background: var(--bg-tertiary);
    padding: 16px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.code-display:hover {
    background: var(--border);
}

.code-display #userCode {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 4px;
    font-family: 'Courier New', monospace;
}

.copy-hint {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.code-display.copied .copy-hint {
    color: var(--success);
}

/* File Section */
.file-section {
    width: 100%;
    margin-bottom: 24px;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.drop-zone.has-file {
    border-style: solid;
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.1);
}

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

.drop-text {
    color: var(--text-secondary);
    font-size: 14px;
}

.file-name {
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-all;
}

/* Peer Section */
.peer-section {
    width: 100%;
    text-align: center;
}

.peer-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.peer-input:focus {
    outline: none;
    border-color: var(--accent);
}

.peer-input::placeholder {
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-secondary);
}

/* Buttons */
.send-btn,
.accept-btn,
.done-btn,
.retry-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.send-btn:hover,
.accept-btn:hover,
.done-btn:hover,
.retry-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.send-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
    transform: none;
}

.cancel-btn,
.reject-btn {
    padding: 12px 24px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-btn:hover,
.reject-btn:hover {
    border-color: var(--error);
    color: var(--error);
}

/* Request Card */
.request-card {
    width: 100%;
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.request-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.request-from {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.request-from span {
    color: var(--accent);
    font-weight: 500;
}

.request-file {
    font-size: 16px;
    font-weight: 500;
    word-break: break-all;
    margin-bottom: 4px;
}

.request-size {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.request-buttons {
    display: flex;
    gap: 12px;
}

.request-buttons .accept-btn,
.request-buttons .reject-btn {
    flex: 1;
}

/* Progress */
.transfer-direction {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.transfer-filename {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 16px;
    word-break: break-all;
}

.progress-container {
    width: 100%;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Complete State */
.complete-icon {
    width: 64px;
    height: 64px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    margin-bottom: 8px;
}

.complete-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
}

/* Error State */
.error-icon {
    width: 64px;
    height: 64px;
    background: var(--error);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    margin-bottom: 8px;
}

.error-text {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
}

/* Ready View Layout */
#readyView {
    justify-content: flex-start;
    padding-top: 16px;
}

/* Responsive */
@media (max-width: 440px) {
    .app {
        width: 100%;
        min-height: 100vh;
        border-radius: 0;
    }
}
