:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #252525;
    --accent: #9f7aea;
    --accent-hover: #805ad5;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --error: #f56565;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-secondary);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    overflow: hidden; /* Add this line */
}

h1 {
    text-align: center;
    color: var(--text-primary);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    font-weight: 700;
}

.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background-color: var(--bg-primary);
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.tab-btn.active {
    background-color: var(--accent);
    color: white;
}

.input-group, .output-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

textarea {
    width: 100%; /* Changed from calc(100% - 2rem) */
    max-width: 100%; /* Changed from calc(100% - 2rem) */
    padding: 1rem;
    border: 2px solid #404040;
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s ease, height 0.3s ease;
    resize: none;  /* Changed from vertical */
    min-height: 80px;
    height: auto;  /* Added */
    overflow-y: hidden;  /* Added */
    box-sizing: border-box;
    white-space: pre-wrap;
    font-family: monospace; /* Match the output display */
}

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

button {
    background-color: var(--accent);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
}

button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

#downloadLink {
    display: block;
    margin-top: 1rem;
    color: var(--accent);
    text-decoration: none;
    text-align: center;
    padding: 1rem;
    border: 2px solid var(--accent);
    border-radius: 8px;
    transition: all 0.3s ease;
}

#downloadLink:hover {
    background-color: var(--accent);
    color: white;
}

#decodedMessage {
    padding: 1rem;
    background-color: var(--bg-primary);
    border-radius: 8px;
    min-height: 50px;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: monospace; /* Better for displaying special characters */
}

.file-drop-area {
    padding: 2rem;
    border: 2px dashed #404040;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    background-color: var(--bg-primary);
}

.image-preview-container {
    position: relative;
    width: 100%;
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--bg-primary);
    display: none;
}

.image-preview-container.active {
    display: block;
}

.image-preview {
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
}

.image-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
}

.message-stats {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

#decodeBtn {
    margin-bottom: 2rem;  /* Add more space after decode button */
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--accent);
    border: none;
    border-radius: 4px;
    padding: 0.5rem;
    width: auto;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.copy-btn:hover {
    opacity: 1;
}

.output-group {
    position: relative;
    margin-top: 1rem;
}

.loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem 2rem;
    border-radius: 8px;
    background-color: var(--accent);
    color: white;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}
