/* Reset i zmienne globalne */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    --accent-primary: #238636;
    --accent-hover: #2ea043;
    --accent-secondary: #1f6feb;
    --accent-secondary-hover: #388bfd;

    --border-color: #30363d;
    --border-muted: #21262d;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;

    --border-radius-sm: 6px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
}

/* Klasa pomocnicza do ukrywania elementów */
.hidden {
    display: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Scroll spacers - puste obszary pozwalające przewinąć zawartość dla lepszego dostępu kciukiem */
/* Domyślnie wyłączone, włączane tylko na urządzeniach mobilnych */
.scroll-spacer-top,
.scroll-spacer-bottom {
    height: 0;
    flex-shrink: 0;
}

/* Header */
.header {
    text-align: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.app-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg,
        var(--accent-primary),
        var(--accent-secondary),
        var(--accent-primary));
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 4s ease-in-out infinite;
    will-change: background-position;
}

.app-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Sections */
.action-section {
    display: flex;
    justify-content: center;
}

/* Empty View - stan pusty bez urządzeń */
.empty-view {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.btn-add-device-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    width: 280px;
    height: 240px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
    box-shadow: var(--shadow-md);
}

.btn-add-device-large:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-secondary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.btn-add-device-large:active {
    transform: translateY(-2px);
}

.btn-add-device-large .plus-icon {
    width: 110px;
    height: 110px;
}

.btn-add-device-large .btn-label {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.btn-add-device-large:hover .btn-label {
    color: var(--text-primary);
}

/* Devices View - widok z urządzeniami */
.devices-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
}

.devices-list {
    min-height: 200px;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    font-size: 0.95rem;
}

.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-muted);
    border-radius: var(--border-radius-sm);
    margin-bottom: 0.75rem;
    transition: all var(--transition-fast);
}

.device-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
}

/* Wizualna wskazówka podczas long press (mobile) */
.device-item-pressing {
    transform: scale(0.98);
    opacity: 0.9;
    background: var(--bg-hover);
    transition: all 150ms ease-out;
}

/* Styl dla przeciągania plików na kafel (drag & drop) */
.device-item-dragover {
    background: linear-gradient(135deg, rgba(35, 134, 54, 0.15) 0%, rgba(31, 111, 235, 0.15) 100%);
    border-color: #238636;
    border-style: dashed;
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(35, 134, 54, 0.3);
    transition: all 150ms ease-out;
}

.device-item:last-child {
    margin-bottom: 0;
}

.device-info {
    flex: 1;
}

.device-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Inline actions - przyciski pod kaflem urządzenia (mobile) */
.device-inline-actions {
    display: flex;
    gap: 0.75rem;
    padding: 0 1rem;
    margin-bottom: 0.75rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 250ms ease-out;
}

.device-inline-actions.active {
    max-height: 120px;
    opacity: 1;
    padding: 0.5rem 1rem 0.75rem 1rem;
}

.inline-action-btn {
    flex: 1;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 1.5rem !important;
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 90px !important;
}

.inline-action-btn:active {
    background: var(--bg-hover) !important;
    border-color: var(--accent-secondary) !important;
    transform: scale(0.97);
}

.inline-action-btn svg {
    width: 40px !important;
    height: 40px !important;
    flex-shrink: 0;
    stroke: var(--accent-secondary) !important;
    fill: none !important;
    stroke-width: 2;
}

.inline-action-btn span {
    display: none;
}

/* Hover actions - przyciski na kaflu urządzenia (tylko desktop) */
@media (hover: hover) and (pointer: fine) {
    .device-hover-actions {
        display: flex;
        flex-direction: row;
        gap: 4px;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .device-item:hover .device-hover-actions {
        opacity: 1;
    }

    .hover-action-btn {
        width: 36px;
        height: 36px;
        padding: 6px;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-sm);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all var(--transition-fast);
    }

    .hover-action-btn:hover {
        background: var(--accent-secondary);
        border-color: var(--accent-secondary);
    }

    .hover-action-btn svg {
        width: 18px;
        height: 18px;
        stroke: var(--text-secondary);
        fill: none;
    }

    .hover-action-btn:hover svg {
        stroke: var(--text-primary);
    }
}

/* Ukryj hover actions na mobile/touch */
@media (hover: none), (pointer: coarse) {
    .device-hover-actions {
        display: none;
    }
}

/* Przycisk "Dodaj urządzenie" w widoku z listą urządzeń */
.btn-add-device-list {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    margin-top: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-muted);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.btn-add-device-list:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
}

.btn-add-device-list .plus-icon-small {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.device-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-small:hover {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
}

.btn-rename {
    color: var(--accent-secondary);
    border-color: var(--accent-secondary);
}

.btn-rename:hover {
    background: var(--accent-secondary);
    color: white;
}

.btn-remove {
    color: #f85149;
    border-color: #f85149;
}

.btn-remove:hover {
    background: #f85149;
    color: white;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    min-width: 200px;
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--accent-secondary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--accent-secondary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Footer */
.footer {
    margin-top: 2rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
}

.key-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.key-icon {
    width: 16px;
    height: 16px;
}

.key-status.ready {
    color: var(--accent-primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    animation: fadeIn var(--transition-normal);
}

.modal.active {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 95vh;
    overflow-y: auto;
    animation: slideUp var(--transition-normal);
    z-index: 2;
    pointer-events: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 2rem 1.5rem;
    text-align: center;
}

.modal-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.modal-hint {
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Receive Files Count */
.receive-files-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: auto;
    margin-right: 1rem;
    white-space: nowrap;
}

/* Receive Files Actions (Download All button) */
.receive-files-actions {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.receive-files-actions .btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Receive Files/Texts Section */
.receive-file-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.receive-file-item:hover {
    background: var(--bg-hover);
}

.receive-file-item:last-child {
    border-bottom: none;
}

.receive-file-item-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* Gdy jest miniatura lub ikona pliku - układ pionowy */
.receive-file-item-content:has(.receive-file-thumbnail),
.receive-file-item-content:has(.receive-file-icon-placeholder) {
    flex-direction: column;
    align-items: center;
}

/* Miniatura pliku w modalu odbierania */
.receive-file-thumbnail {
    width: 100%;
    max-width: 300px;
    max-height: 40vh;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    flex-shrink: 0;
}

/* Placeholder ikony pliku (gdy brak miniatury) */
.receive-file-icon-placeholder {
    width: 100%;
    max-width: 300px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 12px;
    flex-shrink: 0;
}

.receive-file-icon-placeholder svg {
    width: 80px;
    height: 80px;
    stroke: var(--text-secondary);
}

/* Info pod miniaturą lub ikoną - wycentrowane */
.receive-file-item-content:has(.receive-file-thumbnail) .receive-file-item-info,
.receive-file-item-content:has(.receive-file-icon-placeholder) .receive-file-item-info {
    text-align: center;
    width: 100%;
}

.receive-file-item-info {
    flex: 1;
    min-width: 0;
}

.receive-file-item-name {
    font-weight: bold;
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: anywhere;
    margin-bottom: 0.25rem;
}

.receive-file-item-meta {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.receive-text-preview {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin: 0.5rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    word-break: break-word;
}

.receive-file-item button {
    flex-shrink: 0;
}

/* Send Text Modal - Mobile First */
.send-text-area {
    width: 100%;
    min-height: 250px;
    padding: 1rem;
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    resize: vertical;
    transition: border-color var(--transition-fast);
    touch-action: manipulation;
}

.send-text-area:focus {
    outline: none;
    border-color: var(--accent-secondary);
    background: var(--bg-primary);
}

.send-text-area::placeholder {
    color: var(--text-muted);
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.modal-buttons .btn {
    width: 100%;
    min-height: 48px;
}

/* View Text Modal - Mobile First */
.view-text-container {
    position: relative;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
}

.view-text-scroll {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding: 1rem;
}

.view-text-content {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    padding-right: 0.5rem;
    padding-bottom: 3.5rem;
    text-align: left;
}

/* Style dla linku w tekście */
.view-text-scroll.is-link {
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.view-text-scroll.is-link:hover {
    background: rgba(var(--accent-primary-rgb, 79, 70, 229), 0.05);
}

.view-text-link {
    color: var(--accent-primary);
    text-decoration: underline;
    word-break: break-all;
    transition: color var(--transition-fast);
}

.view-text-link:hover {
    color: var(--accent-primary-hover);
}

.btn-copy-text {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-secondary);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    flex-shrink: 0;
}

.btn-copy-text:hover {
    background: var(--accent-secondary-hover);
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
}

.btn-copy-text:active {
    transform: scale(0.95);
}

.btn-copy-text svg {
    width: 20px;
    height: 20px;
}

#viewTextModal .modal-hint {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* View Text Modal - Mobile: bottom sheet */
@media (max-width: 639px) {
    #viewTextModal .modal-content {
        top: auto;
        bottom: 0;
        max-height: 80vh;
    }
}

/* Device Actions Menu */
.device-actions-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.action-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    text-align: left;
    width: 100%;
}

.action-menu-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-secondary);
    transform: translateX(4px);
}

.action-menu-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.action-menu-btn-danger {
    color: #f85149;
    border-color: #f85149;
}

.action-menu-btn-danger:hover {
    background: rgba(248, 81, 73, 0.1);
    border-color: #f85149;
}

.action-menu-separator {
    height: 1px;
    background: var(--border-muted);
    margin: 0.5rem 0;
}

/* Make device items clickable */
.device-item {
    cursor: pointer;
    user-select: none;
}

/* Share Code Section - 6-cyfrowy kod */
.share-code-section {
    margin-bottom: 1.5rem;
}

.share-code-display {
    font-size: 3.5rem;
    font-weight: 700;
    font-family: 'Roboto Mono', 'Courier New', Consolas, monospace;
    letter-spacing: 0.5rem;
    color: var(--accent-primary);
    background: var(--bg-tertiary);
    padding: 1.5rem 2rem;
    border-radius: var(--border-radius-md);
    border: 2px solid var(--border-color);
    margin: 1rem 0;
    text-align: center;
    user-select: all;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.share-code-display:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(35, 134, 54, 0.2);
}

.share-code-timer-container {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
    margin: 1rem 0 0.5rem 0;
}

.share-code-timer-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 999px;
    transition: width 1s linear;
    width: 100%;
}

.share-code-timer-bar.warning {
    background: linear-gradient(90deg, #f85149, #d29922);
}

/* Modal OR separator */
.modal-or-separator {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 2rem 0;
    text-align: center;
    letter-spacing: 0.2rem;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Input Code Section */
.input-code-section {
    margin-bottom: 0;
}

.input-code-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
}

.input-share-code {
    width: 100%;
    font-size: 3.5rem;
    font-weight: 700;
    font-family: 'Roboto Mono', 'Courier New', Consolas, monospace;
    letter-spacing: 0.5rem;
    text-align: center;
    padding: 1.5rem 2rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    outline: none;
}

.input-share-code:focus {
    border-color: var(--accent-secondary);
    box-shadow: 0 0 20px rgba(31, 111, 235, 0.2);
}

.input-share-code::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Adjust button in input container */
.input-code-container .btn {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translate(-50%, -45%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Responsywność - Mobile First */

/* Smartfony (do 640px) */
@media (max-width: 640px) {
    .container {
        padding: 0.75rem;
    }

    .scroll-spacer-top,
    .scroll-spacer-bottom {
        height: 50vh;
    }

    .header {
        padding: 0.25rem 0;
        margin-bottom: 1rem;
    }

    .app-title {
        font-size: 1.75rem;
        margin-bottom: 0.25rem;
    }

    .app-subtitle {
        font-size: 0.875rem;
    }

    .main-content {
        flex: none;
        gap: 1rem;
    }

    .empty-view {
        flex: none;
        padding: 1rem;
    }

    .footer {
        margin-top: 1rem;
        padding: 1rem 0;
    }

    .key-info {
        font-size: 0.8rem;
    }

    .btn {
        min-width: 100%;
        padding: 1rem 2rem;
        font-size: 1.05rem;
    }

    .btn-add-device-large {
        width: 220px;
        height: 180px;
        gap: 1rem;
    }

    .btn-add-device-large .plus-icon {
        width: 70px;
        height: 70px;
    }

    .btn-add-device-large .btn-label {
        font-size: 0.95rem;
    }

    .devices-section {
        padding: 1rem;
    }

    .device-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .device-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .btn-small {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }

    .modal-content {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        transform: none;
        border-radius: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        animation: fadeIn var(--transition-normal);
    }

    .modal-header,
    .modal-body {
        padding: 1rem;
    }

    .modal-or-separator {
        margin: 1.5rem 0;
        font-size: 1.25rem;
        font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    }

    .share-code-display {
        font-size: 2rem;
        letter-spacing: 0.25rem;
        padding: 0.75rem 1rem;
    }

    .share-code-section,
    .input-code-section {
        margin-bottom: 1rem;
    }

    .modal-description {
        margin-bottom: 0.75rem;
        font-size: 1.1rem;
        font-weight: 700;
        font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    }

    .modal-hint {
        margin-top: 0.75rem;
        font-size: 0.8rem;
        font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    }

    .input-share-code {
        font-size: 2rem;
        letter-spacing: 0.25rem;
        padding: 0.75rem;
    }

    .input-code-container {
        flex-direction: column;
    }

    .input-code-container .btn {
        width: 100%;
        min-width: 100%;
        padding: 0.75rem;
    }

    /* Receive Files/Texts - Mobile */
    .modal-title {
        font-size: 1.1rem;
    }

    .receive-file-item {
        padding: 1rem;
    }

    .receive-file-item-content {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .receive-file-thumbnail {
        width: 100%;
        max-width: none;
        max-height: 50vh;
        aspect-ratio: auto;
        object-fit: contain;
        border-radius: 12px;
    }

    .receive-file-item-info {
        width: 100%;
        text-align: center;
    }

    .receive-file-item-name {
        font-size: 1rem;
    }

    .receive-file-item-meta {
        font-size: 0.9em;
    }

    .receive-text-preview {
        font-size: 0.85em;
        -webkit-line-clamp: 2;
    }

    .receive-file-item button {
        width: 100%;
        min-height: 44px;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

}

/* Desktop (powyżej 640px) */
@media (min-width: 641px) {
    /* Send Text Modal - Desktop */
    .send-text-area {
        min-height: 200px;
        font-size: 0.95rem;
        padding: 0.75rem;
        line-height: 1.5;
    }

    .modal-buttons {
        flex-direction: row;
        justify-content: flex-end;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }

    .modal-buttons .btn {
        width: auto;
        min-height: auto;
        min-width: 120px;
    }

    /* View Text Modal - Desktop */
    .view-text-scroll {
        max-height: 60vh;
    }

    .view-text-content {
        font-size: 0.95rem;
        line-height: 1.6;
        padding-right: 0.5rem;
        padding-bottom: 3rem;
    }

    .btn-copy-text {
        width: 40px;
        height: 40px;
    }

    .btn-copy-text svg {
        width: 18px;
        height: 18px;
    }
}

/* Tablety (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    .container {
        padding: 1.5rem;
    }

    .scroll-spacer-top,
    .scroll-spacer-bottom {
        height: 50vh;
    }

    .header {
        padding: 0.5rem 0;
    }

    .btn {
        min-width: 250px;
    }
}

/* Desktopy (powyżej 1024px) */
@media (min-width: 1025px) {
    .container {
        padding: 2rem;
    }

    .header {
        padding: 3rem 0;
    }

    .app-title {
        font-size: 3rem;
    }

    .main-content {
        gap: 2rem;
    }

    .devices-section {
        padding: 2rem;
    }

    .btn {
        min-width: 220px;
    }
}

/* Hover states tylko dla urządzeń z kursorem */
@media (hover: hover) {
    .btn:hover:not(:disabled) {
        transform: translateY(-2px);
    }
}

/* Dark mode preferowany przez system */
@media (prefers-color-scheme: dark) {
    /* Już mamy ciemny motyw jako domyślny */
}

/* Redukcja animacji dla użytkowników preferujących */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============== Style dla stron Auth (login/activate) ============== */

.auth-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 2rem;
    text-align: center;
}

.auth-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.auth-status p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.auth-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.auth-description {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 400px;
    line-height: 1.5;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    min-width: 250px;
}

.auth-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--error-color, #f85149);
}

.error-icon {
    width: 48px;
    height: 48px;
    stroke: var(--error-color, #f85149);
}

.auth-error p {
    font-size: 1rem;
    max-width: 400px;
}

.auth-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--accent-green);
}

.success-icon {
    width: 48px;
    height: 48px;
    stroke: var(--accent-green);
}

.auth-success p {
    font-size: 1rem;
}

.auth-redirect {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Przycisk wylogowania */
.btn-logout {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.btn-logout:hover {
    opacity: 1;
}

.btn-logout svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-secondary);
}

/* Footer z przyciskiem wylogowania */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============== Koniec stylów Auth ============== */
