:root {
    --bg-main: #212121;
    --bg-surface: #171717;
    --bg-card: #2f2f2f;
    --bg-input: #262626;
    --bg-hover: #383838;

    --border-color: #3e3e3e;
    --border-light: #484848;

    --text-primary: #ececec;
    --text-secondary: #b4b4b4;
    --text-muted: #8e8e8e;

    --accent: #ffffff;
    --accent-blue: #4da3ff;
    --accent-blue-hover: #6ab2ff;

    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);

    --success: #10b981;
    --warning: #f59e0b;

    --radius: 12px;
}


/* ==========================================
   RESET
========================================== */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;

    background: var(--bg-main);
    color: var(--text-primary);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    -webkit-font-smoothing: antialiased;
}


/* ==========================================
   APP
========================================== */

.app-container {
    width: min(720px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0 28px;
}


/* ==========================================
   HEADER
========================================== */

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 24px;
}

.header-title {
    min-width: 0;
}

.header-title h1 {
    margin: 0;

    font-size: 27px;
    font-weight: 700;
    letter-spacing: -0.6px;
}

.header-subtitle {
    display: block;

    margin-top: 4px;

    color: var(--text-muted);

    font-size: 13px;
}


/* ==========================================
   STATUS
========================================== */

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;

    flex-shrink: 0;

    padding: 7px 11px;

    border: 1px solid var(--border-color);
    border-radius: 999px;

    background: #292929;

    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 600;
}

.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--warning);
}

.status-badge.connected {
    color: #b9f7df;
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.08);
}

.status-badge.connected .status-dot {
    background: var(--success);
}

.status-badge.error {
    color: #ffc4c4;
    border-color: rgba(239, 68, 68, 0.25);
    background: var(--danger-bg);
}

.status-badge.error .status-dot {
    background: var(--danger);
}


/* ==========================================
   MAIN
========================================== */

.main-content {
    width: 100%;
}

.view-section {
    width: 100%;
}


/* ==========================================
   CARDS
========================================== */

.card {
    margin-bottom: 14px;
    padding: 22px;

    border: 1px solid var(--border-color);
    border-radius: var(--radius);

    background: var(--bg-card);
}

.hero-card {
    padding-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;

    gap: 10px;

    margin-bottom: 10px;
}

.card-header h2 {
    margin: 0;

    font-size: 16px;
    font-weight: 650;

    letter-spacing: -0.15px;
}

.card-icon {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;

    border-radius: 8px;

    background: #3a3a3a;

    font-size: 14px;
}

.card-description {
    margin: 0;

    color: var(--text-secondary);

    font-size: 14px;
    line-height: 1.6;
}


/* ==========================================
   LINK
========================================== */

.link-box {
    display: flex;
    align-items: stretch;

    gap: 8px;

    width: 100%;
}

.link-box input {
    min-width: 0;
    flex: 1;

    height: 42px;

    padding: 0 12px;

    border: 1px solid var(--border-color);
    border-radius: 9px;

    outline: none;

    background: var(--bg-input);
    color: var(--text-primary);

    font-size: 13px;
}

.link-box input:focus {
    border-color: #5b5b5b;
}

.id-row {
    display: flex;
    align-items: center;

    gap: 8px;

    margin-top: 11px;

    color: var(--text-muted);

    font-size: 12px;
}

.id-row code {
    padding: 3px 7px;

    border-radius: 6px;

    background: #242424;

    color: var(--text-secondary);

    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        monospace;

    font-size: 12px;
}


/* ==========================================
   INPUTS
========================================== */

.input-group {
    display: flex;
    gap: 8px;
}

.input-group input {
    min-width: 0;
    flex: 1;

    height: 42px;

    padding: 0 12px;

    border: 1px solid var(--border-color);
    border-radius: 9px;

    outline: none;

    background: var(--bg-input);
    color: var(--text-primary);

    font-size: 14px;
}

.input-group input::placeholder {
    color: #777;
}

.input-group input:focus {
    border-color: #5b5b5b;
}

.input-help {
    margin: 10px 0 0;

    color: var(--text-muted);

    font-size: 12px;
}


/* ==========================================
   BUTTONS
========================================== */

button {
    font-family: inherit;
}

.primary-btn,
.secondary-btn,
.danger-btn {
    height: 42px;

    padding: 0 15px;

    border-radius: 9px;

    border: 1px solid transparent;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease,
        opacity 0.15s ease;
}

.primary-btn {
    background: #f1f1f1;
    color: #171717;
}

.primary-btn:hover:not(:disabled) {
    background: #ffffff;
    transform: translateY(-1px);
}

.primary-btn:active:not(:disabled) {
    transform: translateY(0);
}

.primary-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.secondary-btn {
    border-color: var(--border-color);
    background: #292929;
    color: var(--text-secondary);
}

.secondary-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.danger-btn {
    border-color: rgba(239, 68, 68, 0.25);
    background: var(--danger-bg);
    color: #f87171;
}

.danger-btn:hover {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.4);
}


/* ==========================================
   TRANSFER HEADER
========================================== */

.transfer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    margin-bottom: 16px;
}

.transfer-header h2 {
    margin: 0;

    font-size: 18px;
    font-weight: 650;
}

.transfer-header span {
    display: block;

    margin-top: 3px;

    color: var(--text-muted);

    font-size: 12px;
}


/* ==========================================
   DROP ZONE
========================================== */

.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-height: 235px;

    padding: 30px;

    border: 1px dashed #505050;
    border-radius: 14px;

    background: #292929;

    text-align: center;

    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        transform 0.15s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #707070;
    background: #303030;
}

.drop-zone.drag-over {
    transform: scale(1.005);
}

.drop-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 54px;
    height: 54px;

    margin-bottom: 14px;

    border-radius: 14px;

    background: #383838;

    color: #d5d5d5;

    font-size: 28px;
}

.drop-zone h3 {
    margin: 0 0 6px;

    font-size: 16px;
    font-weight: 650;
}

.drop-zone p {
    margin: 0 0 18px;

    color: var(--text-muted);

    font-size: 13px;
}


/* ==========================================
   FILE CARD
========================================== */

.file-card {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;

    margin-top: 14px;
    padding: 15px;

    border: 1px solid var(--border-color);
    border-radius: 12px;

    background: var(--bg-card);
}

.file-main {
    display: flex;
    align-items: center;

    gap: 12px;

    min-width: 0;
}

.file-icon-large {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;

    flex: 0 0 44px;

    border-radius: 10px;

    background: #383838;

    font-size: 20px;
}

.file-details {
    display: flex;
    flex-direction: column;

    min-width: 0;
}

.file-details strong {
    overflow: hidden;

    max-width: 360px;

    color: var(--text-primary);

    font-size: 13px;
    font-weight: 600;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.file-details span {
    margin-top: 3px;

    color: var(--text-muted);

    font-size: 12px;
}

.file-actions {
    display: flex;
    gap: 7px;

    flex-shrink: 0;
}


/* ==========================================
   PROGRESS
========================================== */

.progress-card {
    margin-top: 14px;
    padding: 17px;

    border: 1px solid var(--border-color);
    border-radius: 12px;

    background: var(--bg-card);
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 10px;

    font-size: 13px;
    font-weight: 600;
}

.progress-header span:last-child {
    color: var(--text-secondary);
}

.progress-track {
    width: 100%;
    height: 6px;

    overflow: hidden;

    border-radius: 999px;

    background: #444;
}

.progress-bar {
    width: 0%;
    height: 100%;

    border-radius: inherit;

    background: #d8d8d8;

    transition: width 0.1s linear;
}

.progress-info {
    display: flex;
    justify-content: space-between;

    gap: 12px;

    margin-top: 9px;

    color: var(--text-muted);

    font-size: 11px;
}


/* ==========================================
   ARCHIVOS RECIBIDOS
========================================== */

.received-section {
    margin-top: 22px;
}

.section-title {
    margin-bottom: 10px;

    color: var(--text-secondary);

    font-size: 13px;
    font-weight: 600;
}


/*
   Cada archivo recibido
*/

.received-file {
    display: flex;
    align-items: center;

    gap: 14px;

    width: 100%;
    min-width: 0;

    padding: 12px;

    margin-bottom: 8px;

    border: 1px solid var(--border-color);
    border-radius: 11px;

    background: var(--bg-card);
}

.received-info {
    display: flex;
    align-items: center;

    gap: 12px;

    flex: 1;
    min-width: 0;
}

.received-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    border-radius: 10px;

    background: #252525;

    font-size: 20px;
}

.received-text {
    flex: 1;
    min-width: 0;

    overflow: hidden;
}

.received-name {
    width: 100%;
    min-width: 0;

    overflow: hidden;

    color: var(--text-primary);

    font-size: 14px;
    font-weight: 600;

    line-height: 20px;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.received-size {
    display: block;

    margin-top: 2px;

    color: var(--text-muted);

    font-size: 12px;

    line-height: 17px;
}


/* ==========================================
   BOTÓN DESCARGAR
========================================== */

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;

    flex: 0 0 40px;

    box-sizing: border-box;

    border: 1px solid var(--border-color);
    border-radius: 10px;

    background: #292929;

    color: var(--text-secondary);

    text-decoration: none;

    cursor: pointer;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}

.download-btn svg {
    width: 18px;
    height: 18px;

    fill: none;

    stroke: currentColor;

    stroke-width: 1.8;

    stroke-linecap: round;
    stroke-linejoin: round;
}

.download-btn:hover {
    background: #333333;

    border-color: #505050;

    color: #ffffff;

    transform: translateY(-1px);
}

.download-btn:active {
    transform: translateY(0);
}


/* ==========================================
   MODAL
========================================== */

.modal-overlay {
    position: fixed;

    inset: 0;

    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(0, 0, 0, 0.62);

    backdrop-filter: blur(4px);
}

.modal-card {
    width: min(430px, 100%);

    padding: 22px;

    border: 1px solid var(--border-light);
    border-radius: 14px;

    background: #2a2a2a;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.45);
}

.modal-header {
    display: flex;
    align-items: center;

    gap: 10px;
}

.modal-header h3 {
    margin: 0;

    font-size: 16px;
}

.modal-icon {
    font-size: 18px;
}

.modal-body {
    margin: 14px 0 20px;

    color: var(--text-secondary);

    font-size: 14px;
    line-height: 1.55;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;

    gap: 8px;
}


/* ==========================================
   FOOTER
========================================== */

.app-footer {
    margin-top: 28px;

    text-align: center;

    color: #686868;

    font-size: 11px;
}


/* ==========================================
   UTILIDADES
========================================== */

.hidden {
    display: none !important;
}


/* ==========================================
   ANIMACIONES
========================================== */

.fade-in {
    animation: fadeIn 0.35s ease both;
}

.slide-up {
    animation: slideUp 0.3s ease both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(7px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ==========================================
   MOBILE
========================================== */

@media (max-width: 600px) {

    .app-container {
        width: min(100% - 20px, 720px);

        padding-top: 22px;
    }

    .main-header {
        align-items: flex-start;
    }

    .header-title h1 {
        font-size: 24px;
    }

    .status-badge {
        padding: 6px 9px;
    }

    .card {
        padding: 17px;
    }

    .link-box,
    .input-group {
        flex-direction: column;
    }

    .link-box input,
    .input-group input {
        width: 100%;
    }

    .link-box .primary-btn,
    .input-group .primary-btn {
        width: 100%;
    }

    .transfer-header {
        align-items: flex-start;
    }

    .file-card {
        align-items: stretch;
        flex-direction: column;
    }

    .file-details strong {
        max-width: calc(100vw - 125px);
    }

    .file-actions {
        width: 100%;
    }

    .file-actions button {
        flex: 1;
    }

    .received-file {
        gap: 10px;
    }

    .received-info {
        gap: 9px;
    }

    .received-icon {
        width: 38px;
        height: 38px;

        flex-basis: 38px;

        font-size: 18px;
    }

    .download-btn {
        width: 38px;
        height: 38px;

        flex-basis: 38px;
    }

    .drop-zone {
        min-height: 210px;

        padding: 24px 16px;
    }

    .danger-btn {
        height: 38px;

        padding: 0 11px;
    }
}


/* ==========================================
   TOUCH
========================================== */

@media (hover: none) {

    .download-btn:hover {
        transform: none;
    }

    .primary-btn:hover {
        transform: none;
    }
}