* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #0a0a0a;
    color: #e8e0d4;
}

.app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    background: #111111;
    display: flex;
    flex-direction: column;
}

header {
    background: #111111;
    padding: 20px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #e8e0d4;
}

.add-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #d4a853;
    color: #0a0a0a;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.add-btn:hover {
    background: #e0b45e;
    transform: scale(1.02);
}

.stats-bar {
    display: flex;
    gap: 20px;
    padding: 16px 20px;
    background: #111111;
    border-bottom: 1px solid #2a2a2a;
}

.stat {
    flex: 1;
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #d4a853;
    font-family: 'DM Mono', monospace;
}

.stat-label {
    font-size: 0.7rem;
    color: #7a7060;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: 'DM Mono', monospace;
}

.filters-bar {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: #111111;
    border-bottom: 1px solid #2a2a2a;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    font-size: 0.85rem;
    background: #1a1a1a;
    color: #e8e0d4;
    font-family: 'DM Mono', monospace;
}

.search-input {
    flex: 2;
    padding: 10px 12px;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    font-size: 0.85rem;
    background: #1a1a1a;
    color: #e8e0d4;
    font-family: 'DM Mono', monospace;
}

.search-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #d4a853;
}

.rolls-container {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.roll-card {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #2a2a2a;
    transition: all 0.2s;
}

.roll-card:hover {
    border-color: #d4a853;
}

.roll-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.roll-title {
    font-size: 1rem;
    font-weight: 500;
    color: #e8e0d4;
    flex: 1;
}

.edit-roll {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: #7a7060;
    padding: 4px 8px;
    transition: color 0.2s;
}

.edit-roll:hover {
    color: #d4a853;
}

.delete-roll {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: #7a7060;
    padding: 4px 8px;
    transition: color 0.2s;
}

.delete-roll:hover {
    color: #c47a7a;
}

.roll-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    font-family: 'DM Mono', monospace;
}

.badge-format {
    background: #2a2a2a;
    color: #7a7060;
}

.badge-type {
    background: #d4a853;
    color: #0a0a0a;
}

.badge-frames {
    background: #1a2a2a;
    color: #7aa8d0;
}

.badge-iso {
    background: #2a2a1a;
    color: #d4a853;
}

.roll-expiry {
    font-size: 0.7rem;
    color: #7a7060;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #2a2a2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'DM Mono', monospace;
}

.expiry-warning {
    color: #d49060;
}

.expiry-expired {
    color: #c47a7a;
}

.backup-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px;
    background: #111111;
    border-top: 1px solid #2a2a2a;
    border-bottom: 1px solid #2a2a2a;
    justify-content: center;
}

.backup-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 16px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Mono', monospace;
    color: #e8e0d4;
}

.backup-btn:hover {
    background: #2a2a2a;
    border-color: #d4a853;
}

.qr-btn {
    background: #d4a853;
    color: #0a0a0a;
    border-color: #d4a853;
}

.qr-btn:hover {
    background: #e0b45e;
}

footer {
    text-align: center;
    padding: 20px;
    color: #7a7060;
    font-size: 0.7rem;
    border-top: 1px solid #2a2a2a;
    margin-top: 20px;
    font-family: 'DM Mono', monospace;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-card {
    background: #111111;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #e8e0d4;
    font-family: 'DM Mono', monospace;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7a7060;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

form {
    padding: 20px;
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: #7a7060;
    font-family: 'DM Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.field input,
.field select {
    width: 100%;
    padding: 12px;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: 'DM Mono', monospace;
    background: #1a1a1a;
    color: #e8e0d4;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: #d4a853;
}

.field select:disabled {
    background-color: #0a0a0a;
    color: #4a4540;
    cursor: not-allowed;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: #d4a853;
    color: #0a0a0a;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
    font-family: 'DM Mono', monospace;
}

.submit-btn:hover {
    background: #e0b45e;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #7a7060;
}

.edit-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #2a2a2a;
    padding: 4px 8px;
    border-radius: 4px;
}

.qty-btn {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    color: #e8e0d4;
    transition: all 0.2s;
}

.qty-btn:hover {
    background: #d4a853;
    color: #0a0a0a;
}

.qty-number {
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    color: #e8e0d4;
}

.roll-header > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* QR y Scanner Styles */
.qr-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.qr-modal-content {
    background: #111111;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    padding: 24px;
    max-width: 90%;
    text-align: center;
}

.qr-modal-image {
    width: 280px;
    height: 280px;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

.qr-modal-stats {
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    color: #e8e0d4;
    margin: 16px 0 8px;
}

.qr-modal-hint {
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    color: #7a7060;
}

.qr-modal-close {
    font-family: 'DM Mono', monospace;
    font-size: 0.6rem;
    color: #4a4540;
    margin-top: 12px;
}

.qr-scanner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.qr-scanner-video {
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    border: 2px solid #d4a853;
}

.qr-scanner-text {
    color: #e8e0d4;
    margin-top: 16px;
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    text-align: center;
    padding: 0 20px;
}

.qr-scanner-button {
    margin-top: 20px;
    padding: 10px 24px;
    background: #d4a853;
    border: none;
    border-radius: 8px;
    font-family: 'DM Mono', monospace;
    cursor: pointer;
    font-size: 0.9rem;
    color: #0a0a0a;
    font-weight: bold;
}

.qr-scanner-button:hover {
    background: #e0b45e;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #2a2a2a;
    border: 1px solid #d4a853;
    color: #e8e0d4;
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    padding: 10px 18px;
    border-radius: 8px;
    z-index: 4000;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    max-width: 90%;
    white-space: normal;
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.btn-secondary {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    color: #e8e0d4;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'DM Mono', monospace;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #3a3a3a;
    border-color: #d4a853;
}

@media (max-width: 480px) {
    .rolls-container {
        padding: 12px;
    }
    
    .backup-buttons {
        flex-direction: column;
    }
    
    .backup-btn {
        width: 100%;
    }
    
    .filters-bar {
        flex-direction: column;
    }
    
    .qr-scanner-video {
        max-width: 90%;
    }
    
    .toast {
        font-size: 0.7rem;
        padding: 8px 14px;
    }
}