:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #38bdf8;
    --primary-hover: #0ea5e9;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --success: #22c55e;
    --border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(56, 189, 248, 0.05) 0%, transparent 20%);
}

#app {
    width: 50%;
    min-width: 450px;
    max-width: 900px;
    height: 95vh;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.8s ease-out;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 10px;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

header h1 span {
    color: var(--primary);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: rgba(15, 23, 42, 0.5);
    padding: 5px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--primary);
    color: var(--bg-color);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

input:focus {
    border-color: var(--primary);
}

.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.primary-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: translateY(0);
}

.danger-btn {
    width: 100%;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    margin-top: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.danger-btn:hover {
    background: var(--danger);
    color: white;
}

.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel:not(.hidden) {
    display: flex !important;
}

#sender-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#sender-controls.hidden {
    display: none !important;
}

.hidden {
    display: none !important;
}

.room-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 12px;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 0;
}

.code-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    padding: 0;
    border: none;
}

#display-room-code {
    font-family: monospace;
    font-size: 1.1rem;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--primary);
}

#btn-copy {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    transition: all 0.2s;
}

#btn-copy:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.drop-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px dashed var(--border);
    border-radius: 20px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.drop-zone:hover, .drop-zone.active {
    border-color: var(--primary);
    background: rgba(56, 189, 248, 0.05);
}

.drop-zone:hover {
    border-color: var(--primary);
    background: rgba(56, 189, 248, 0.05);
}

.drop-zone.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.1);
}

.drop-zone.disabled:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: transparent;
}

/* Chat Styles */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    margin-bottom: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-input-area {
    padding: 12px 15px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-area textarea {
    flex: 1;
    width: 90%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 15px;
    color: white;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
    resize: none;
    min-height: 45px;
    max-height: 150px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-input-area textarea:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.msg {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.msg:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.msg:active {
    transform: scale(0.98);
}

.msg:hover::after {
    content: 'Click to copy';
    position: absolute;
    bottom: -18px;
    right: 5px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    white-space: nowrap;
}

.msg.sent {
    align-self: flex-end;
    background: var(--primary);
    color: #000;
    font-weight: 500;
    border-bottom-right-radius: 2px;
}

.msg.received {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-bottom-left-radius: 2px;
}

.system-msg {
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chat-input-area {
    padding: 15px;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 15px;
    color: white;
    outline: none;
    transition: border-color 0.2s;
}

.input-with-btn {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-btn input {
    padding-right: 45px;
}

.input-with-btn .icon-btn {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
}

/* Chat Setup Styles */
.chat-setup {
    padding: 40px 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-setup > p {
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.chat-setup-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.chat-setup-grid {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 20px;
}

.setup-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
}

.setup-box label {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
}

.divider-v {
    position: relative;
    height: 100px;
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.divider-v span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1a1a1a;
    padding: 5px 0;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
}

.secondary-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.chat-container.hidden, .chat-setup.hidden {
    display: none;
}

/* Chat Progress Styles */
.chat-progress {
    padding: 10px 15px;
    background: rgba(56, 189, 248, 0.08);
    border-bottom: 1px solid rgba(56, 189, 248, 0.1);
}

.chat-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--primary);
    margin-bottom: 6px;
    font-weight: 600;
}

.chat-progress-bg {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.chat-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.1s linear;
    box-shadow: 0 0 10px var(--primary);
}

.primary-btn svg {
    flex-shrink: 0;
}
.drop-msg svg {
    margin-bottom: 15px;
    color: var(--primary);
}

.drop-msg p {
    font-weight: 400;
}

.drop-msg p span {
    color: var(--primary);
    font-weight: 600;
}

.drop-msg small {
    display: block;
    margin-top: 10px;
    color: var(--text-muted);
}

.progress-container {
    height: 8px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    transition: width 0.1s linear;
}

.file-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
}

.transfer-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.stat label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat span {
    font-weight: 600;
    font-size: 0.9rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(56, 189, 248, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

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

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: #1e293b;
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    margin-top: 10px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border-left: 4px solid var(--primary);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@media (max-width: 480px) {
    .glass-card {
        padding: 20px;
    }
    .transfer-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.primary-btn.square {
    width: 45px !important;
    height: 45px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 12px;
}

#btn-attach {
    color: var(--text-muted);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#btn-attach:hover {
    color: var(--primary);
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.2);
    transform: rotate(15deg);
}

.chat-container {
    position: relative;
}

.chat-drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border: 2px dashed var(--primary);
    border-radius: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.chat-drop-overlay.active {
    opacity: 1;
}

.chat-drop-overlay svg {
    color: var(--primary);
    margin-bottom: 15px;
    animation: bounce 1s infinite;
}

.chat-drop-overlay p {
    color: var(--primary);
    font-weight: 600;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
