* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(to bottom right, #163371 0%, #3D7BF6 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

/* Semi-transparent logo watermark */
.watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150vw;
    max-width: 2000px;
    height: auto;
    opacity: 0.12;
    filter: brightness(0) invert(1);
    z-index: 0;
    pointer-events: none;
}

/* Content layer */
.content-layer {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 600px;
}

.container {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 600px;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
    border: 1px solid #e2e8f0;
    backdrop-filter: blur(4px);
    transition: all 0.5s ease;
}

/* Envelope open state - simple navy blue accent at top */
.container.envelope-open {
    border-top: 4px solid #1e3a5f;
}

/* Envelope closed state - professional navy blue envelope */
.container.envelope-closed {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: #2c5282 !important;
    border: none !important;
    position: relative;
    overflow: visible;
}

/* Create envelope flap effect */
.container.envelope-closed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to bottom, #234363 0%, #2c5282 100%);
    clip-path: polygon(0 0, 50% 80px, 100% 0);
    z-index: 2;
}

/* Envelope body shadow for depth */
.container.envelope-closed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 5%;
    right: 5%;
    height: 60%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.08) 0%, transparent 100%);
    border-radius: 0 0 0.75rem 0.75rem;
    z-index: 0;
}

/* Heimlane wax seal on envelope flap */
.wax-seal {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%) rotate(-3deg);
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #3D7BF6 0%, #2D6BE6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.2),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    z-index: 3;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.wax-seal::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3) 0%, transparent 60%);
    pointer-events: none;
}

.wax-seal img {
    width: 50px;
    height: 50px;
    filter: brightness(0) invert(1) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    z-index: 1;
    position: relative;
}

/* Password lock overlay on wax seal */
.password-lock-overlay {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    z-index: 4;
}

.password-lock-overlay svg {
    width: 32px;
    height: 32px;
}

/* Hide only Vault logo when envelope is closed, keep Heimlane logo and footer visible */
.container.envelope-closed .logo-vault-card {
    display: none !important;
}

/* Make Heimlane logo white when envelope is closed */
.container.envelope-closed .logo-heimlane-card {
    filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Make footer text white when envelope is closed */
.container.envelope-closed .footer {
    color: white;
    border-top-color: rgba(255, 255, 255, 0.3);
}

.container.envelope-closed .footer a {
    color: white;
    text-decoration: underline;
}

.container.envelope-closed .footer a:hover {
    color: #f8fafc;
}

.closed-envelope-content {
    text-align: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.envelope-message {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin-bottom: 2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.envelope-message.password-protected-message {
    margin-top: 5.5rem;
}

.reveal-button {
    padding: 1rem 3rem;
    background: white;
    color: #dc2626;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

.reveal-button:hover {
    background: #f8fafc;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.reveal-button:active {
    transform: translateY(0);
}

/* Password protected state - deep blue with lock icon */
.container.password-protected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    background: linear-gradient(135deg, #2c5282 0%, #3b6ba8 100%);
    border: none !important;
    position: relative;
    padding-bottom: 4rem;
}

/* Hide logos when password protected */
.container.password-protected .logo-vault-card {
    display: none !important;
}

.container.password-protected .logo-heimlane-card {
    filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Make footer white when password protected and position at bottom */
.container.password-protected .footer {
    color: white;
    border-top-color: rgba(255, 255, 255, 0.3);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 1rem 1.5rem;
}

.container.password-protected .footer a {
    color: white;
    text-decoration: underline;
}

.container.password-protected .footer a:hover {
    color: #f8fafc;
}

.password-lock-icon {
    text-align: center;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.password-content {
    text-align: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 450px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.password-message {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.75rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.password-explanation {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

/* Shredded envelope state (when max access count reached) */
.container.shredded-envelope {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: linear-gradient(to bottom, #f8fafc 0%, #e2e8f0 100%);
    border: 1px dashed #cbd5e1 !important;
    position: relative;
}

.shredded-content {
    text-align: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.shredded-icon {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

.shredded-message {
    font-size: 1.5rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 1rem;
}

.shredded-explanation {
    font-size: 1rem;
    color: #64748b;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* Close envelope button (shown when envelope is open) */
.close-envelope-button {
    margin-top: 1rem;
    padding: 0.75rem 2rem;
    background: white;
    color: #dc2626;
    border: 2px solid #dc2626;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.close-envelope-button:hover {
    background: #fef2f2;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.close-envelope-button:active {
    transform: translateY(0);
}

/* Heimlane logo in top-left corner */
.logo-heimlane-card {
    position: absolute;
    top: 1rem;
    left: 1rem;
    height: 4rem;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    z-index: 10;
}

/* Vault logo in top-right corner */
.logo-vault-card {
    position: absolute;
    top: 1rem;
    right: 1rem;
    height: 4rem;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    z-index: 10;
}

/* Sender information */
.sender-info {
    background: #eff6ff;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    color: #475569;
    border-left: 3px solid #3b82f6;
}

.sender-info strong {
    color: #1e293b;
    font-weight: 600;
}

/* Remove top padding when envelope is closed, keep it for open state */
.container.envelope-open #content {
    padding-top: 5rem;
}

#content {
    padding-top: 0;
}

.secure-message-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.send-content {
    margin-top: 1.25rem;
}

.send-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 1rem;
}

.send-text {
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-break: break-word;
    color: #334155;
    line-height: 1.6;
    border: 1px solid #e2e8f0;
}

.password-form {
    margin-top: 1.5rem;
    width: 100%;
}

.password-form input {
    width: 100%;
    padding: 1rem 1.25rem;
    height: 3.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0.5rem;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.password-form input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: white;
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.password-form input::placeholder {
    color: #94a3b8;
}

.password-form button {
    width: 100%;
    height: 3.5rem;
    padding: 0.875rem;
    background: white;
    color: #dc2626;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

.password-form button:hover {
    background: #f8fafc;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.password-form button:active {
    transform: translateY(0);
}

.error {
    background: #fef2f2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1.25rem;
    border-left: 3px solid #dc2626;
}

.loading {
    text-align: center;
    color: #64748b;
    padding: 2.5rem;
}

.info {
    background: #f1f5f9;
    padding: 0.875rem;
    border-radius: 0.5rem;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: #64748b;
}

.copy-button {
    margin-top: 1rem;
    width: 100%;
    height: 3rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(to right, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.copy-button:hover {
    background: linear-gradient(to right, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

.copy-button:active {
    transform: translateY(0);
}

.file-info {
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 0.5rem;
    margin: 1.25rem 0;
    border: 1px solid #e2e8f0;
}

.file-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.file-size {
    font-size: 0.875rem;
    color: #64748b;
}

.download-button {
    width: 100%;
    height: 3rem;
    padding: 0.75rem;
    background: linear-gradient(to right, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.download-button:hover {
    background: linear-gradient(to right, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

.download-button:active {
    transform: translateY(0);
}

.download-button:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.875rem;
    color: #64748b;
}

.footer a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    body {
        padding: 0.5rem;
    }

    .container {
        padding: 1rem;
    }

    .envelope-icon-large svg {
        width: 80px;
        height: 80px;
    }

    .envelope-message {
        font-size: 1.125rem;
    }

    .logo-heimlane-card,
    .logo-vault-card {
        height: 3rem;
    }

    #content {
        padding-top: 4rem;
    }
}
