:root {
    --bg-color: #000000;
    --text-color: #e7e9ea;
    --text-muted: #71767b;
    --border-color: #2f3336;
    --header-bg: rgba(0, 0, 0, 0.75);
    --hover-bg: rgba(255, 255, 255, 0.03);
    --tweet-hover-bg: rgba(255, 255, 255, 0.06); /* Stacked dark mode color */
    --avatar-bg: #333333;
    color-scheme: dark;
}

/* Light mode overrides */
body.light-mode {
    --bg-color: #ffffff;
    --text-color: #0f1419;
    --text-muted: #536471;
    --border-color: #cfd9de;
    --header-bg: rgba(255, 255, 255, 0.85);
    --hover-bg: rgba(0, 0, 0, 0.08);
    --tweet-hover-bg: rgba(0, 0, 0, 0.15); /* Stacked light mode color */
    --avatar-bg: #536471;
    color-scheme: light;
}

body { 
    background: var(--bg-color); 
    color: var(--text-color); 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; 
    margin: 0; 
    padding: 0; 
    display: flex; 
    justify-content: center;
}

#layout-wrapper { display: flex; flex-direction: row; min-height: 100vh; }

#app-container { 
    width: 600px; 
    border-left: 1px solid var(--border-color); 
    border-right: 1px solid var(--border-color); 
    zoom: 1.1; /* Scales everything inside the container uniformly by 10% */
}

/* Header updated to push the toggle button to the right */
.app-header { 
    position: sticky; top: 0; 
    background: var(--header-bg); 
    backdrop-filter: blur(12px); 
    border-bottom: 1px solid var(--border-color); 
    padding: 0 16px; height: 53px; 
    display: flex; align-items: center; justify-content: space-between; z-index: 100; 
}

.app-header h2 { font-size: 20px; margin: 0; font-weight: 700; }

/* Theme Toggle Button Styling */
.theme-toggle-btn { 
    background: none; border: none; cursor: pointer; padding: 6px; 
    display: flex; align-items: center; border-radius: 50%; 
    color: var(--text-color); transition: background 0.2s; 
}
.theme-toggle-btn:hover { background: var(--hover-bg); }

.tweet { 
    padding: 12px 16px; 
    display: flex; 
    gap: 12px; 
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease; 
    cursor: pointer; 
}

/* Updated hover state using the new, darker stacked variables */
.tweet:hover { background-color: var(--tweet-hover-bg); }

.avatar-col { flex-shrink: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--avatar-bg); }

.content-col { flex: 1; }
.tweet-header { display: flex; align-items: baseline; gap: 4px; margin-bottom: 2px; font-size: 15px; }
.name { font-weight: 700; color: var(--text-color); }
.handle { color: var(--text-muted); font-weight: 400; }
.content-wrapper { 
    font-size: 15px; 
    line-height: 20px; 
    color: var(--text-color); 
    margin-bottom: 4px; 
    word-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

/* Clickable Handles: */
.clickable-handle {
    color: #1d9bf0;;
    text-decoration: none;
    transition: text-decoration 0.2s;
}
.clickable-handle:hover {
    text-decoration: underline;
}

.platform-card {
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: space-between; 
    gap: 12px;
    padding: 8px;
    transition: transform 0.2s ease;
}
.platform-card:hover {
    transform: scale(1.06);
}

/* --- NEW MODAL STYLES PORTED FROM DESKTOP APP --- */

.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; 
    background: rgba(0,0,0,0.5); z-index: 10000; display: flex; 
    align-items: flex-start; justify-content: center; padding-top: 5vh; 
    backdrop-filter: blur(2px); 
}

.compose-card { 
    background: var(--bg-color); width: 600px; border-radius: 16px; 
    display: flex; flex-direction: column; overflow: hidden; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.3); border: 1px solid var(--border-color); 
}

.compose-header { 
    display: flex; align-items: center; padding: 0 16px; height: 53px; 
    border-bottom: 1px solid var(--border-color); 
}

.close-btn { 
    background: none; border: none; color: var(--text-color); font-size: 18px; 
    cursor: pointer; padding: 8px; border-radius: 50%; width: 36px; height: 36px; 
    display: flex; align-items: center; justify-content: center; transition: background-color 0.2s; 
}
.close-btn:hover { background-color: var(--hover-bg); }

.compose-body { display: flex; padding: 16px; gap: 12px; }

/* --- CUSTOM INPUT STYLES (WITH FIXED @ PREFIX) --- */

.input-wrapper {
    display: flex;
    flex-direction: column; /* Stack the input and the expiration text */
    align-items: flex-start;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: transparent;
    padding: 2px 6px; /* Reduced padding for height */
    margin-bottom: 4px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: #1d9bf0;
}

.at-prefix {
    color: var(--text-muted);
    font-size: 12px;
    margin-right: 2px;
	margin-top: 5px;
    font-weight: bold;
}

.renew-input-handle {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 12px;
    outline: none;
	margin-top:7px
}

.renew-input {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    padding: 6px;
    font-size: 12px;
    box-sizing: border-box;
    outline: none;
    margin-bottom: 4px;
    text-align: center;
}
.renew-input:focus {
    border-color: #1d9bf0;
}

.renew-exp {
    font-size: 9px; /* Smaller font to fit on a single line */
    color: var(--text-muted);
    margin-top: 0px;
    margin-bottom: 0px;
    text-align: left; /* Align to the left to match the input */
    white-space: nowrap; /* Prevent breaking into multiple lines */
    min-height: 12px; /* Reserve the space permanently */
}

.renew-submit-btn {
    background: var(--text-color);
    color: var(--bg-color);
    border: none;
    padding: 6px;
    border-radius: 9999px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    font-size: 11px;
    margin-top: 8px;
}
.renew-submit-btn:hover {
    opacity: 0.8;
}

/* --- COMPOSITE EXTEND BUTTON --- */
.extend-composite-wrapper {
    display: flex;
    align-items: center;
    background: var(--text-color);
    border-radius: 9999px;
    margin-top: 8px;
    width: 100%;
    overflow: hidden;
    transition: opacity 0.2s;
}

.extend-composite-wrapper:hover {
    opacity: 0.8;
}

.extend-composite-btn {
    background: transparent;
    color: var(--bg-color);
    border: none;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    padding: 6px 8px;
    flex: 1;
}

/* Align text to sit naturally next to the centered input */
.extend-composite-btn.left {
    text-align: right;
    padding-right: 1px;
}

.extend-composite-btn.right {
    text-align: left;
    padding-left: 1px;
}

.extend-composite-input {
    width: 36px;
    /* Semi-transparent background adds subtle depth inside the button */
    background: rgba(127, 127, 127, 0.3); 
    color: var(--bg-color);
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    padding: 4px 0;
    outline: none;
    -moz-appearance: textfield; /* Hides default arrows in Firefox */
}

/* Hides default arrows in Chrome/Safari/Edge */
.extend-composite-input::-webkit-outer-spin-button,
.extend-composite-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}