*{
    box-sizing: border-box;
}

:root {
    /* Light Mode Default */
    --bg-color: #ffffff;
    --text-color: #3d3d3d;
    --card-bg: #ffffff;
    --border-color: #ddd;
    --input-bg: #ebebeb;
    --primary: #010202; /* Standard Blue */
    --primary-hover: #000000;
    --hover-overlay: rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --text-color: #eee;
        --card-bg: #000000;
        --border-color: #454545;
        --input-bg: #2c2c2c;
        --primary: #eee; /* Uses a slightly lighter blue for dark mode visibility */
        --primary-hover: #000000;
        --hover-overlay: rgba(255, 255, 255, 0.1);
    }
}

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column; /* Changed for footer sticky behavior */
    align-items: center;
}

header {
    position: sticky;
    position: -webkit-sticky;
    top: 0;
    left: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: var(--bg-color);
    padding: 0 1rem;
    border-bottom: 1px solid var(--border-color);
}
header a {
    text-decoration: none;
    color: var(--text-color);
}
header .right,
header .left {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
header .left a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
header .logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}
header .btn-1 {
    padding: 0.5rem;
    border-radius: 5px;
    background: linear-gradient(135deg, #fbff00, #ff7300);
    color: #000;
    font-weight: 500;
    font-size: 0.87em;
    text-decoration: none;
}
header .btn-2 {
    background: var(--text-color);
    padding: 0.5rem;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4em;
}

header .pro-badge {
    padding: 0.5rem;
    border-radius: 5px;
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.87em;
    cursor: pointer;
}

.pro-tag {
    display: inline-block;
    padding: 2px 6px;
    margin-left: 8px;
    border-radius: 4px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    font-weight: 700;
    font-size: 0.7em;
    vertical-align: middle;
    border: 1px solid #DAA520;
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 2rem 0;
    margin: 0;
    box-sizing: border-box;
    flex: 1; /* Pushes footer down */
    display: flex;
    flex-direction: column;
}
.container.protected {
    max-width: 500px;
}
.intro h1 {
    text-align: left;
    font-size: 1.6rem;
}
/* Range Slider */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    margin-top: 5px;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #FFD700;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(128, 128, 128, 0.2);
    border-radius: 2px;
}

/* Flat Card */
.shortener-card {
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 1rem;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    color: var(--primary);
    font-weight: 700;
    margin-top: 0;
}

.input-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 400;
    font-size: 0.87rem;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="datetime-local"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border-radius: 5px;
    border: none;
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    box-sizing: border-box;
    transition: background 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
}

#options-toggle {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    margin-bottom: 1rem;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
}

#advanced-options {
    margin-bottom: 1.5rem;
}

.btn {
    width: 100%;
    padding: 14px;
     background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--input-bg);
  transition: .4s;
  border-radius: 34px;
  border: 1px solid var(--border-color);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-color);
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(24px);
  background-color: var(--bg-color); /* Switch knob becomes bg color (contrast) on active */
}

/* Result Area */
#result {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.hidden {
    display: none;
}

.result-link {
    background: transparent;
    padding: 1rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
}

.result-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    word-break: break-all;
    margin-right: 1rem;
}

.result-link a:hover {
    text-decoration: underline;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}

.copy-btn:hover {
    background: var(--text-color);
    color: var(--bg-color);
}

#qr-code {
    display: flex;
    justify-content: center;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 4px;
    width: fit-content;
    margin: 0 auto;
    flex-direction: column;
    gap: 0.5rem;
}

.error-msg {
    color: #ff0000;
    border: 1px solid #ff0000;
    padding: 10px;
    border-radius: 4px;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

/* Footer */
footer {
    width: 100%;
    padding: 1.5rem;
    text-align: center;
    margin-top: auto;
    color: #868686;
}

footer a {
    color: #808080;
    text-decoration: none;
    margin: 0 0.5rem;
    font-size: 0.8rem;
}
footer p {
    color: #808080;
    margin: 0.5rem;
    font-size: 0.8rem;
}

footer a:hover {
    color: var(--primary);
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 1rem 0;
    }
}

/* Modal Styles */
.modal {
    display: flex; /* Hidden toggled via class */
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.5); 
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: var(--card-bg);
    margin: auto;
    padding: 2rem;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: relative;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(0px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--text-color);
    text-decoration: none;
    cursor: pointer;
}

.pro-form {
    margin-top: 1.5rem;
}

.btn-outline {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid var(--primary);
    color: var(--primary);
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    margin-top: 0.5rem;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--bg-color);
}

.buy-license {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* PRO Modal Updates */
.pro-features-list ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    text-align: left;
}
.pro-features-list li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-color);
}
.pro-features-list li::before {
    content: "✓";
    color: #FFA500;
    position: absolute;
    left: 0;
    font-weight: bold;
}
.pro-price {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}
.pro-price .price-tag {
    font-weight: bold;
    color: var(--primary);
    background: linear-gradient(135deg, #FFD700, #FFA500);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.msg-box {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 0.9rem;
}
.msg-box.success {
    background-color: rgba(0, 255, 0, 0.1);
    color: green;
    border: 1px solid green;
}
.msg-box.error {
    background-color: rgba(255, 0, 0, 0.1);
    color: red;
    border: 1px solid red;
}

.expiry-warning {
    margin-top: 1rem;
    padding: 10px;
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
}
.expiry-warning a {
    color: #856404;
    text-decoration: underline;
    font-weight: bold;
}
