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

:root {
    --background: #f5f5f5;
    --text: #1a1a1a;
    --accent: #1a1a1a;
    --border: #1a1a1a;
    --card-bg: #ffffff;
    --subtle-bg: #f0f0f0;
    --subtle-text: #737373;
    --error-bg: #ffeded;
    --error-text: #c00;
    --shadow-offset: 4px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--background);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem;
    color: var(--text);
}

.main-layout {
    display: flex;
    width: 100%;
    max-width: 1200px;
    gap: 2rem;
}

.editor-main {
    flex: 3;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 4rem);
}

.editor-sidebar {
    flex: 1;
    min-width: 300px;
}

/* Mobile submit button */
.mobile-submit-btn {
    display: none;
}

.mobile-submit-btn::before {
    content: '✓';
    font-size: 1.2rem;
    font-weight: bold;
}

/* Modal styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 0;
}

.modal-overlay.show {
    display: flex;
    align-items: flex-end;
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    border: 2px solid var(--border);
    border-bottom: none;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.3rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: auto;
    color: var(--text);
    box-shadow: none;
}

.modal-close:hover {
    transform: none;
    box-shadow: none;
}

.modal-body {
    padding: 1.5rem;
}

.container {
    width: 100%;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
}

.sidebar-card {
    padding: 1.5rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--border);
    margin-bottom: 1.5rem;
}

.sidebar-card h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.note-container { max-width: 800px; margin: 0 auto; }
.not-found-container { max-width: 500px; text-align: center; margin: 0 auto; }

h1 {
    color: var(--text);
    text-align: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.not-found-container h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

textarea#noteContent {
    flex-grow: 1;
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    background: var(--card-bg);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--border);
}

textarea#noteContent:focus {
    outline: none;
    border-color: var(--accent);
}

.char-count {
    text-align: right;
    font-size: 0.85rem;
    color: var(--subtle-text);
    margin-top: 0.5rem;
    padding-right: 0.5rem;
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--card-bg);
}

input[type="text"]:focus, input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
}

.password-group {
    display: flex;
    gap: 0.5rem;
}

button {
    width: 100%;
    padding: 0.85rem 1.5rem;
    background: var(--accent);
    color: var(--background);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--border);
}

button:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px var(--border);
}

button:active {
    transform: translate(var(--shadow-offset), var(--shadow-offset));
    box-shadow: 0 0 0 var(--border);
}

button:disabled {
    background: #ccc;
    border-color: #999;
    color: #777;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-secondary {
    background: var(--subtle-bg);
    color: var(--text);
    font-weight: 500;
    box-shadow: 2px 2px 0px var(--border);
}

.btn-secondary:hover {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px var(--border);
}
.btn-secondary:active {
    transform: translate(2px, 2px);
    box-shadow: 0 0 0 var(--border);
}

.expiration-options {
    display: flex;
    gap: 0.5rem;
}

.expiration-option {
    flex: 1;
}

.expiration-option input[type="radio"] {
    display: none;
}

.expiration-option label {
    display: block;
    padding: 0.6rem;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0;
    font-weight: 500;
}

.expiration-option input[type="radio"]:checked + label {
    background: var(--accent);
    color: var(--card-bg);
}

.result {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    display: none;
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--border);
}

.result.show {
    display: block;
}

.result-url {
    word-break: break-all;
    padding: 0.75rem;
    background: var(--subtle-bg);
    border-radius: 4px;
    margin: 0.5rem 0 1rem 0;
    font-family: monospace;
    border: 1px solid var(--border);
}

.copy-btn {
    background: var(--subtle-bg);
    color: var(--text);
    font-weight: 500;
    box-shadow: 2px 2px 0px var(--border);
}

.info-box {
    background: var(--subtle-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    border: 2px solid var(--border);
}

.loading {
    display: none;
    text-align: center;
    padding: 1rem;
    font-weight: 500;
}

.loading.show {
    display: block;
}

/* Spinner styles */
.spinner {
    display: none;
    margin: 0 auto;
    width: 32px;
    height: 32px;
    border: 3px solid var(--subtle-bg);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.show {
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Full-screen validation spinner */
.validation-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(245, 245, 245, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
}

.validation-overlay.show {
    display: flex;
}

.validation-overlay .spinner {
    display: block;
    width: 48px;
    height: 48px;
    border-width: 4px;
}

.validation-overlay .validation-message {
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
}

/* Validation state for button */
button.validating {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

.decrypt-form {
    margin-bottom: 2rem;
}

.error {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 2px solid var(--error-text);
    display: none;
    font-weight: 500;
}

.error.show {
    display: block;
}

.note-content {
    display: none;
}

.note-content.show {
    display: block;
}

.note-text {
    background: var(--card-bg);
    padding: 1rem 0;
    line-height: 1.7;
    word-wrap: break-word;
}

.note-text > *:first-child {
    margin-top: 0;
}

.note-text h1, .note-text h2, .note-text h3, .note-text h4, .note-text h5, .note-text h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: var(--text);
    font-weight: 700;
}

.note-text h1 { font-size: 2em; }
.note-text h2 { font-size: 1.75em; }
.note-text h3 { font-size: 1.5em; }

.note-text p {
    margin-bottom: 1em;
}

.note-text code {
    background: var(--subtle-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.9em;
    border: 1px solid #ddd;
}

.note-text pre {
    background: var(--subtle-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #ddd;
    overflow-x: auto;
    margin-bottom: 1em;
}

.note-text pre code {
    background: none;
    padding: 0;
    border: none;
}

.note-text a {
    color: var(--text);
    font-weight: 600;
}

.note-text a:hover {
    text-decoration: underline;
}

.note-text ul, .note-text ol {
    margin-left: 2rem;
    margin-bottom: 1em;
}

.note-text blockquote {
    border-left: 4px solid var(--border);
    padding-left: 1rem;
    margin: 1.5em 0;
    color: var(--subtle-text);
    font-style: italic;
}

.not-found-container p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.not-found-container a {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: var(--accent);
    color: var(--background);
    text-decoration: none;
    border-radius: 8px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--border);
    transition: all 0.2s;
    font-weight: 700;
}

.not-found-container a:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px var(--border);
}

.result-item {
    margin-bottom: 1rem;
}

.result-item p {
    margin-bottom: 0.25rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.note-footer-cta {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border);
    text-align: center;
    font-size: 0.9rem;
    color: var(--subtle-text);
}

.note-footer-cta a {
    color: var(--text);
    font-weight: 600;
    text-decoration: underline;
}

.note-footer-cta a:hover {
    color: var(--accent);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
        align-items: stretch;
    }

    .main-layout {
        flex-direction: column;
        gap: 0;
        height: 100vh;
    }

    .editor-main {
        flex: 1;
        height: auto;
        min-height: 0;
        padding-top: 60px; /* Space for mobile submit button */
    }

    textarea#noteContent {
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        box-shadow: none;
        height: 100%;
    }

    .char-count {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--card-bg);
        border-top: 2px solid var(--border);
        padding: 0.75rem 1rem;
        margin: 0;
        z-index: 50;
    }

    .editor-sidebar {
        display: none;
    }

    .mobile-submit-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
        border-radius: 0;
        box-shadow: none;
        border-left: none;
        border-right: none;
        border-top: none;
    }

    .container {
        border-radius: 0;
        border-left: none;
        border-right: none;
        min-height: 100vh;
        padding: 1.5rem;
    }

    .note-container {
        padding: 1.5rem;
    }

    .not-found-container {
        padding: 2rem 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .sidebar-card {
        box-shadow: none;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 0;
        margin-bottom: 1.5rem;
    }

    .result {
        box-shadow: none;
    }

    button {
        box-shadow: 2px 2px 0px var(--border);
    }

    button:hover {
        transform: translate(1px, 1px);
        box-shadow: 1px 1px 0px var(--border);
    }

    button:active {
        transform: translate(2px, 2px);
        box-shadow: 0 0 0 var(--border);
    }
}
