:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: #334155;
    --success-color: #10b981;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 3rem;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, var(--accent-color), #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo svg {
    color: var(--accent-color);
    width: 32px;
    height: 32px;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: transparent;
    padding: 0;
    border: none;
    border-radius: 0;
    justify-content: center;
    box-shadow: none;
    max-width: 100%;
}

.nav-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 2rem; /* Fully rounded pills */
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    white-space: nowrap;
}

.nav-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.nav-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.4);
}

main {
    flex: 1;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: rgba(59, 130, 246, 0.3);
}

/* Specific input sizing */
#pwd-length {
    max-width: 100px;
}

h2, h3 {
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

h3 {
    font-size: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.input-group {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 150px;
}

.input-wrapper.full-width {
    width: 100%;
    flex: 1 1 100%;
}

/* Checkbox Group Styling */
.checkbox-group {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    padding: 0 1.25rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    height: 46px; /* Match input height */
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin: 0;
    color: var(--text-primary);
    user-select: none;
}

.checkbox-group input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent-color);
}

/* Password Result Styling */
#pwd-result {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
    border: 2px solid var(--accent-color);
    cursor: pointer;
    transition: all 0.2s;
    height: auto;
    padding: 1rem;
}

#pwd-result:hover {
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input, select {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    transition: border-color 0.2s;
    width: 100%;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.cidr-select-wrapper {
    display: flex;
    gap: 0.5rem;
}

.cidr-select-wrapper input {
    width: 80px;
    text-align: center;
}

.primary-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: var(--font-sans);
    height: 46px; /* Match input height */
}

.primary-btn:hover {
    background: var(--accent-hover);
}

.result-grid {
    display: grid;
    gap: 1rem;
}

.result-item {
    display: grid;
    grid-template-columns: 150px 1fr;
    align-items: baseline;
    padding: 0.5rem 0;
}

.result-item .label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.result-item .value {
    color: var(--accent-color);
    font-weight: 500;
}

.result-item .binary {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-left: 1rem;
    opacity: 0.7;
    display: block;
    margin-top: 0.25rem;
}

@media (min-width: 768px) {
    .result-item {
        grid-template-columns: 150px auto 1fr;
        align-items: center;
    }
    .result-item .binary {
        margin-top: 0;
        display: inline;
    }
}

.mono {
    font-family: var(--font-mono);
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.hidden {
    display: none;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-secondary);
    font-weight: 500;
    font-family: var(--font-sans);
}

td {
    color: var(--text-primary);
}

tr:last-child td {
    border-bottom: none;
}

/* Converter Grid */
.converter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 2rem;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .primary-btn {
        width: 100%;
    }
    
    .result-item {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .result-item .binary {
        margin-left: 0;
    }
}
