/*
* MORELESS Subnet Calculator - Main Stylesheet
* Professional network analysis tool with subnet calculation
* Mobile-first responsive design optimized for performance
*/

/* CSS Variables - Same as Word Counter for consistency */
:root {
    /* MORELESS Brand Colors */
    --color-dark: #031024;
    --color-dark-accent: #051e3e;
    --color-dark-light: #0a1a35;
    --color-primary: #FF4D29;
    --color-primary-light: rgba(255, 77, 41, 0.1);
    --color-primary-dark: #e64024;
    --color-secondary: #0055A4;
    --color-secondary-light: rgba(0, 85, 164, 0.1);
    --color-white: #FFFFFF;
    --color-light-gray: rgba(255, 255, 255, 0.7);
    --color-gray: rgba(255, 255, 255, 0.5);
    --color-dark-gray: rgba(255, 255, 255, 0.1);
    --color-success: #1e884ac7;
    --color-success-light: rgba(39, 174, 96, 0.1);
    --color-warning: #F39C12;
    --color-warning-light: rgba(243, 156, 18, 0.1);
    --color-error: #E74C3C;
    --color-error-light: rgba(231, 76, 60, 0.1);
    --color-info: #3498DB;
    --color-info-light: rgba(52, 152, 219, 0.1);
    --color-purple: #9B59B6;
    --color-purple-light: rgba(155, 89, 182, 0.1);
    
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-md: 1.125rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 1.875rem;
    --font-size-3xl: 2.25rem;
    --font-size-4xl: 3rem;
    
    /* Spacing System */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
    --space-3xl: 3rem;
    
    /* Border Radius */
    --radius-xs: 0.125rem;
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-bounce: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(255, 255, 255, 0.1);
    
    /* Glass Morphism Variables */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-bg-hover: rgba(255, 77, 41, 0.15);
    --glass-bg-secondary: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-light: rgba(255, 255, 255, 0.05);
    --glass-blur: blur(20px) saturate(120%);
    --glass-blur-light: blur(8px) saturate(110%);
    --text-primary: rgba(255, 255, 255, 0.92);
    --text-secondary: rgba(255, 255, 255, 0.75);

    /* Z-Index Scale */
    --z-behind: -1;
    --z-normal: 0;
    --z-sticky: 50;
    --z-fixed: 100;
    --z-overlay: 1000;
    --z-modal: 2000;
    --z-tooltip: 3000;
}

/* Global Resets */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: radial-gradient(ellipse at top left, #05204b 25%, #031127 60%);
    background-attachment: fixed;
    overflow-x: hidden;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    box-sizing: border-box;
    position: relative;
    opacity: 1;
}

body.page-ready .main-content {
    opacity: 1;
    transition: opacity 0.2s ease-out;
}

/* AD SPACE RESERVATION - Wide screens (1600px+) */
@media (max-width: 1600px) {
    .page-layout {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
        padding: 0 var(--space-md);
        max-width: 1200px;
        margin: 0 auto;
    }

    .main-column {
        max-width: 1200px;
        width: 100%;
    }
}

/* Remove orange gradient on tablet and mobile */
@media (max-width: 900px) {
    body {
        background: linear-gradient(180deg, #05204b 0%, #031127 100%);
    }
}

/* Modal open - prevent body scroll */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Enhanced Glass Morphism Orb */
body::before {
    content: '';
    position: fixed;
    top: -200px;
    right: -200px;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(255, 77, 41, 0.15), transparent 60%);
    filter: blur(100px);
    z-index: 1;
    pointer-events: none;
}

/* Selection Styling */
::selection {
    background: var(--color-primary);
    color: var(--color-white);
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 16, 36, 0.95);
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--color-dark-gray);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Layout */
.main-content {
    opacity: 0;
    margin-top: 80px;
    min-height: calc(100vh - 80px);
    padding: var(--space-md) 0;
    position: relative;
    background: radial-gradient(circle at 15% 10%, rgb(255 77 41 / 11%) -2%, transparent 30%),
                radial-gradient(circle at 70% 85%, rgba(0, 85, 164, 0.12) 0%, transparent 55%);
    width: 100%;
    box-sizing: border-box;
}

.page-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    width: 100%;
}

.main-column {
    min-width: 0;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Container Classes */
.tool-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    position: relative;
}

.tool-container .content-wrapper {
    padding: var(--space-xl) var(--space-lg) var(--space-lg);
}

.wide-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.wide-container .content-wrapper {
    padding: var(--space-xl) var(--space-lg) var(--space-lg);
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: var(--space-md);
    padding: var(--space-xs) 0;
}

.hero-title {
    font-size: var(--font-size-xl);
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 0;
    background: linear-gradient(135deg, var(--color-white) 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    font-size: var(--font-size-base);
    color: var(--color-light-gray);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.3;
}

/* Content Wrapper */
.content-wrapper {
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-md);
    padding: var(--space-2xl);
    position: relative;
    overflow: hidden;
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-primary), var(--color-secondary), transparent);
}

/* Spacing between content wrappers */
.content-wrapper.stats-wrapper {
    margin-top: var(--space-3xl);
    margin-bottom: var(--space-3xl);
}

.content-wrapper.cheat-wrapper {
    margin-top: var(--space-3xl);
    margin-bottom: var(--space-3xl);
}

.content-wrapper.features-wrapper {
    margin-top: var(--space-3xl);
    margin-bottom: var(--space-3xl);
}

.content-wrapper.faq-wrapper {
    margin-top: var(--space-3xl);
    margin-bottom: var(--space-3xl);
}

/* Mode Selector Row */
.mode-selector-row {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-dark-gray);
    transition: margin-bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                padding-bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-selector-row.collapsed {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
}

.mode-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
    margin: 0;
}

.mode-label i {
    color: var(--color-primary);
    font-size: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   MODE TABS - ICON-INTEGRATED CARDS (COMPACT FLEXBOX - 2 TABS)
   ═══════════════════════════════════════════════════════════════ */

.mode-buttons-integrated {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px;
    justify-content: center;
}

.mode-btn-integrated {
    flex: 1 1 200px;
    max-width: 250px;
    min-width: 200px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.mode-btn-integrated::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #FF4D29, #ff6b47);
    transform: scaleY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-btn-integrated:hover {
    transform: translateX(4px);
    border-color: rgba(255, 77, 41, 0.4);
    background: rgba(255, 77, 41, 0.08);
}

.mode-btn-integrated:hover::before {
    transform: scaleY(1);
}

.mode-btn-integrated.active {
    background: rgba(25, 111, 61, 0.15);
    border-color: #196F3D;
}

.mode-btn-integrated.active::before {
    transform: scaleY(1);
    background: linear-gradient(180deg, #196F3D, #228B22);
}

.mode-icon-integrated {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #FF4D29, #ff6b47);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #ffffff;
    flex-shrink: 0;
}

.mode-btn-integrated.active .mode-icon-integrated {
    background: linear-gradient(135deg, #196F3D, #228B22);
}

.mode-content-integrated {
    flex: 1;
    min-width: 0;
}

.mode-title-integrated {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    color: #ffffff;
    margin-bottom: 2px;
}

.mode-desc-integrated {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.65);
    white-space: nowrap;
}

/* MODE COLLAPSE/EXPAND FUNCTIONALITY */
.mode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.mode-collapse-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-collapse-btn:hover {
    background: rgba(255, 77, 41, 0.12);
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
}

.mode-collapse-btn i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-selector-row.collapsed .mode-collapse-btn i {
    transform: rotate(180deg);
}

.mode-collapsible-content {
    max-height: 200px;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
}

.mode-selector-row.collapsed .mode-collapsible-content {
    max-height: 0;
    opacity: 0;
}

/* Auto-calculate Section */
.auto-calculate-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-dark-gray);
    margin-top: var(--space-xl);
}

.auto-calculate-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    color: var(--color-light-gray);
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-label:hover {
    color: var(--color-white);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid var(--color-gray);
    border-radius: var(--radius-sm);
    position: relative;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    color: var(--color-white);
    font-size: 12px;
    font-weight: 700;
    transition: transform var(--transition-bounce);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.auto-calculate-stats {
    display: flex;
    gap: var(--space-md);
}

.auto-calculate-stats .stat-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: var(--radius-md);
    min-width: 80px;
    height: 44.77px;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.auto-calculate-stats .stat-number {
    font-size: 14px;
    font-weight: 900;
    color: var(--color-white);
    font-family: var(--font-primary);
}

.auto-calculate-stats .stat-label {
    font-size: 9px;
    color: var(--color-white);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Quick Stats Bar */
.quick-stats-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-md);
    margin-top: var(--space-xs);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-dark-gray);
}

.quick-stat {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

.quick-stat:hover {
    transform: translate3d(0, -2px, 0);
    will-change: transform;
    background: rgba(255, 77, 41, 0.15);
    border-color: var(--color-primary);
}

.quick-stat.primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}

.stat-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: var(--radius-md);
    color: var(--color-white);
    font-size: var(--font-size-lg);
}

.quick-stat.primary .stat-icon {
    background: rgba(255, 255, 255, 0.2);
    color: var(--color-white);
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-weight: 900;
    color: var(--color-white);
    font-family: var(--font-primary);
    line-height: 1;
    font-size: 14px;
    word-break: break-all;
}

.stat-label {
    font-size: 9px;
    color: var(--color-light-gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
    white-space: nowrap;
}

/* Text Tools Bar */
.text-tools-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-tool-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-size: var(--font-size-sm);
    overflow: hidden;
}

.text-tool-btn:hover {
    transform: translate3d(0, -2px, 0) scale3d(1.01, 1.01, 1);
    will-change: transform;
    border-color: rgba(255, 77, 41, 0.4);
    background: var(--glass-bg-hover);
}

.text-tool-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.text-tool-btn:disabled:hover {
    background: var(--color-dark-light);
    border-color: transparent;
    color: var(--color-light-gray);
    transform: none;
}

.text-tool-btn.special {
    background: rgba(52, 152, 219, 0.12);
    border-color: rgba(52, 152, 219, 0.18);
    color: rgba(52, 152, 219, 0.9);
    margin-left: auto;
}

.text-tool-btn.special:hover {
    background: rgba(52, 152, 219, 0.15);
    border-color: rgba(52, 152, 219, 0.25);
    color: #3498db;
    transform: translate3d(0, -2px, 0) scale3d(1.01, 1.01, 1);
    will-change: transform;
}

.text-tool-btn.clear-btn {
    background: rgba(231, 76, 60, 0.12);
    border-color: rgba(231, 76, 60, 0.18);
    color: rgba(231, 76, 60, 0.9);
}

.text-tool-btn.clear-btn:hover {
    background: rgba(231, 76, 60, 0.15);
    border-color: rgba(231, 76, 60, 0.25);
    color: #e74c3c;
    transform: translate3d(0, -2px, 0) scale3d(1.01, 1.01, 1);
    will-change: transform;
}

.text-tool-btn.active {
    background: rgba(25, 111, 61, 0.15);
    border-color: #196F3D;
    transform: translate3d(0, -2px, 0);
}

.text-tool-btn.active:hover {
    background: rgba(25, 111, 61, 0.2);
    border-color: #196F3D;
    transform: translate3d(0, -4px, 0) scale3d(1.02, 1.02, 1);
}

.tool-label {
    font-size: var(--font-size-md);
    font-weight: 700;
}

.text-tools-separator {
    width: 1px;
    height: 24px;
    background: var(--color-gray);
    opacity: 0.3;
    margin: 0 var(--space-sm);
}

.text-tools-spacer {
    flex: 1;
}

/* Input Section */
.input-section {
    /* No margin-bottom */
    text-align: center;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.input-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-label i {
    color: var(--color-primary);
}

.text-input {
    padding: var(--space-md);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    background: rgba(8, 22, 50, 0.55);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: var(--font-primary);
    outline: none;
    transition: border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.text-input:focus {
    border-color: var(--color-primary);
}

.text-input::placeholder {
    color: var(--color-gray);
}

.subnet-input {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    letter-spacing: 0;
    background: rgba(8, 22, 50, 0.55);
}

.input-hint {
    font-size: var(--font-size-xs);
    color: var(--color-gray);
}

.input-labels-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-sm);
    /* NO margin-bottom! Gap from .input-group handles spacing */
}

.input-labels-row .input-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* First label in row should flex to match input */
.input-labels-row .input-label:first-child {
    flex: 1;
}

/* Second label should match CIDR dropdown width */
.input-labels-row .input-label:last-child {
    min-width: 200px;
}

.input-with-dropdown {
    position: relative;
    display: flex;
    gap: var(--space-sm);
}

.input-with-dropdown .text-input {
    flex: 1;
}

.cidr-select {
    padding: var(--space-md);
    background: rgba(8, 22, 50, 0.45);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-primary);
    outline: none;
    cursor: pointer;
    transition: border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 200px;
}

/* IPv6 prefix select should be full width */
.ipv6-prefix-select {
    width: 100%;
    min-width: auto;
    background: rgba(8, 22, 50, 0.45);
}

/* Hide elements controlled by JS - NEVER use inline styles! */
.hidden {
    display: none;
}

/* Hide IPv4-only elements when in IPv6 mode (controlled by JS) */
.ipv4-only.hidden {
    display: none;
}

/* Hide IPv6-only elements by default, show only in IPv6 mode */
.ipv6-only {
    display: none;
}

.ipv6-only.visible {
    display: flex;
}

.cidr-select:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.cidr-select:focus {
    border-color: var(--color-primary);
}

/* Optgroup styling for better visual separation */
.cidr-select optgroup {
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    background: rgba(255, 77, 41, 0.1);
    padding: var(--space-sm) 0;
    font-style: normal;
}

.cidr-select option {
    font-weight: 500;
    padding: var(--space-sm);
    background: var(--color-dark-accent);
    color: var(--text-primary);
}

/* Calculate Button */
.calculate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border: 1px solid rgba(255, 77, 41, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-white);
    font-size: var(--font-size-sm);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.calculate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-slow);
    z-index: -1;
}

.calculate-btn:hover {
    transform: translateY(-2px) scale(1.01);
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
}

.calculate-btn:hover::before {
    left: 100%;
}

.calculate-btn:active {
    transform: translateY(0);
}

/* Statistics Wrapper */
.stats-wrapper {
    /* Spacing handled by .content-wrapper.stats-wrapper above */
}

/* Tabs */
.stats-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-dark-gray);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    color: var(--color-light-gray);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
    background: var(--color-dark-gray);
    transform: translate3d(0, -1px, 0);
    will-change: transform;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-color: var(--color-primary);
    color: var(--color-white);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: var(--radius-md);
    color: var(--color-white);
    font-size: var(--font-size-lg);
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-title {
    font-size: var(--font-size-xs);
    color: var(--color-light-gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-number {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-white);
    font-family: var(--font-primary);
    word-break: break-all;
}

.stat-copy-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 77, 41, 0.1);
    border: 1px solid rgba(255, 77, 41, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-primary);
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    transform: translateZ(0);
}

.stat-copy-btn:hover {
    background: var(--color-primary);
    color: var(--color-white);
    transform: translate3d(0, -2px, 0) scale3d(1.05, 1.05, 1);
}

/* Binary View Tab */
.binary-view {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.binary-item {
    display: grid;
    grid-template-columns: 150px 1fr auto;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    align-items: start;
}

.binary-label {
    font-size: var(--font-size-sm);
    color: var(--color-light-gray);
    font-weight: 600;
}

.binary-decimal {
    color: var(--color-primary);
    font-weight: 700;
    font-size: var(--font-size-base);
    word-break: break-all;
}

.binary-value {
    color: var(--color-white);
    font-size: 13px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    letter-spacing: 0.5px;
    word-break: break-word;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* Binary item content wrapper - stacks decimal and binary vertically */
.binary-item-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* Binary item with visualization - special grid layout */
.binary-item-with-viz {
    grid-template-columns: 150px 1fr auto;
    grid-template-rows: auto auto;
}

.binary-item-with-viz .bit-visualization {
    grid-column: 1 / -1;
}

.binary-copy-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 77, 41, 0.1);
    border: 1px solid rgba(255, 77, 41, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-primary);
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.binary-copy-btn:hover {
    background: var(--color-primary);
    color: var(--color-white);
    transform: translate3d(0, -2px, 0) scale3d(1.05, 1.05, 1);
}

.binary-copy-btn:active {
    transform: translate3d(0, 0, 0) scale3d(0.95, 0.95, 1);
}

/* Bit Visualization - Octet Blocks + Ruler */
.bit-visualization {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Ruler visualization at top */
.bit-ruler {
    position: relative;
    height: 36px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.bit-ruler-network,
.bit-ruler-host {
    position: absolute;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.bit-ruler-network {
    left: 0;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white);
    border-right: 2px solid rgba(255, 255, 255, 0.3);
}

.bit-ruler-host {
    right: 0;
    background: rgba(255, 255, 255, 0.14);
    color: var(--color-light-gray);
}

/* Octet blocks container */
.bit-octets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: var(--space-sm);
}

/* Individual octet block */
.bit-octet {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: help;
    min-height: 70px;
}

.bit-octet:hover {
    transform: translateY(-2px);
}

/* Network bits - orange styling */
.bit-octet.network {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 77, 41, 0.3);
}

.bit-octet.network:hover {
    border-color: var(--color-primary);
}

/* Host bits - gray styling */
.bit-octet.host {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Decimal value in octet */
.bit-octet-decimal {
    font-size: var(--font-size-lg);
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.bit-octet.network .bit-octet-decimal {
    color: var(--color-primary);
}

.bit-octet.host .bit-octet-decimal {
    color: var(--color-light-gray);
}

/* Binary value in octet */
.bit-octet-binary {
    font-size: 9px;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    word-break: break-all;
}

/* IPv6 hex value */
.bit-octet-hex {
    font-size: var(--font-size-lg);
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.bit-octet.ipv6.network .bit-octet-hex {
    color: var(--color-primary);
}

.bit-octet.ipv6.host .bit-octet-hex {
    color: var(--color-light-gray);
}

/* IPv6 binary - slightly smaller for 16 bits */
.bit-octet.ipv6 .bit-octet-binary {
    font-size: 8px;
    letter-spacing: 0.5px;
}

/* Subnets Tab */
.subnets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.subnets-header h4 {
    font-size: var(--font-size-md);
    color: var(--color-white);
    margin: 0;
}

.subnet-controls {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.subnet-count-input {
    padding: var(--space-sm) var(--space-md);
    background: rgba(8, 22, 50, 0.55);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    width: 150px;
    outline: none;
    transition: border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.subnet-count-input:focus {
    border-color: var(--color-primary);
}

.subnet-generate-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-white);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.subnet-generate-btn:hover {
    background: var(--color-primary-dark);
    transform: translate3d(0, -1px, 0);
    will-change: transform;
}

.subnet-list {
    display: grid;
    gap: var(--space-sm);
    max-height: 400px;
    overflow-y: auto;
    padding-right: var(--space-sm);
}

.subnet-item {
    display: grid;
    grid-template-columns: 40px 2fr 3fr 1.5fr;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
}

.subnet-item:hover {
    background: var(--color-primary-light);
}

.subnet-number {
    color: var(--color-primary);
    font-weight: 700;
    text-align: center;
}

.subnet-network,
.subnet-range,
.subnet-broadcast {
    color: var(--color-white);
}

.subnet-hosts {
    color: var(--color-light-gray);
    text-align: right;
    white-space: nowrap;
}

/* How to Use Section */
.usage-compact {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

.usage-steps-horizontal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    flex-wrap: nowrap;
    margin-bottom: var(--space-2xl);
}

.usage-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 200px;
}

.step-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #ff6b47 100%);
    border-radius: 50%;
    margin-bottom: var(--space-md);
    transition: all 0.3s ease;
}

.step-icon:hover {
    transform: scale3d(1.05, 1.05, 1);
    will-change: transform;
}

.step-icon i {
    font-size: 1.5rem;
    color: white;
}

.step-num {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--color-dark);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: 800;
    border: 2px solid var(--color-primary);
}

.usage-step h4 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.usage-step p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.step-arrow {
    color: var(--color-primary);
    font-size: 1.5rem;
    opacity: 0.7;
}

/* Quick Features Row */
.quick-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
}

.quick-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 72px;
    text-align: center;
}

.quick-feature:hover {
    background: rgba(255, 77, 41, 0.15);
    border-color: var(--color-primary);
    transform: translate3d(0, -2px, 0) scale3d(1.01, 1.01, 1);
    will-change: transform;
}

.quick-feature i {
    font-size: 1.25rem;
    color: var(--color-primary);
    flex-shrink: 0;
}

.quick-feature span {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

/* Features Section */
.section-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.section-header h2 {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--color-white);
    margin-bottom: var(--space-lg);
}

.section-header p {
    font-size: var(--font-size-md);
    color: var(--color-light-gray);
    max-width: 600px;
    margin: 0 auto;
}

.section-header-with-action {
    position: relative;
}

.docs-link-btn {
    position: absolute;
    top: 0;
    right: 0;
    height: 32px;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0 var(--space-md);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border: 1px solid rgba(255, 77, 41, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-white);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.docs-link-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-slow);
}

.docs-link-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
}

.docs-link-btn:hover::before {
    left: 100%;
}

.docs-link-btn i {
    color: var(--color-white);
}

.docs-link-short {
    display: none;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    margin-top: var(--space-2xl);
}

.feature-card {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    transform: scaleX(0);
    transition: transform var(--transition-normal);
}

.feature-card:hover {
    background: rgba(255, 77, 41, 0.15);
    border-color: var(--color-primary);
    transform: translate3d(0, -2px, 0) scale3d(1.01, 1.01, 1);
    will-change: transform;
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
    font-size: var(--font-size-xl);
    color: var(--color-white);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover .feature-icon {
    transform: scale(1.1) rotate(5deg);
}

.feature-card h3 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-white);
    margin-bottom: var(--space-md);
}

.feature-card p {
    color: var(--color-light-gray);
    line-height: 1.6;
}

/* FAQ Section */
.faq-grid {
    display: grid;
    gap: var(--space-md);
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item:hover {
    background: rgba(255, 77, 41, 0.15);
    border-color: var(--color-primary);
    transform: translate3d(0, -2px, 0) scale3d(1.01, 1.01, 1);
    will-change: transform;
}

.faq-question {
    padding: var(--space-xl);
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.faq-question:hover {
    background: rgba(255, 77, 41, 0.1);
}

.faq-question h3 {
    font-size: var(--font-size-md);
    color: var(--color-white);
    font-weight: 600;
    margin: 0;
}

.faq-question i {
    color: var(--color-primary);
    font-size: var(--font-size-sm);
    transition: transform var(--transition-normal);
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

.faq-item.active .faq-answer {
    max-height: 300px;
}

.faq-answer-content {
    padding: 0 var(--space-xl) var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.faq-answer p {
    color: var(--color-light-gray);
    line-height: 1.6;
    margin: 0;
    width: 100%;
}

/* Export Modal */
.modal-overlay,
.tool-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 30% 40%, rgba(255, 77, 41, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(0, 85, 164, 0.10) 0%, transparent 50%),
        linear-gradient(135deg, rgba(3, 16, 36, 0.97) 0%, rgba(5, 30, 62, 0.98) 50%, rgba(3, 16, 36, 0.99) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.modal-overlay.show,
.tool-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-container,
.tool-modal-content {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.8) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show .modal-container,
.tool-modal.show .tool-modal-content {
    transform: scale(1) translateY(0);
}

.modal-header,
.tool-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xl);
    border-bottom: 1px solid var(--color-dark-gray);
}

.modal-header h3,
.tool-modal-title {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--color-white);
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin: 0;
    font-family: var(--font-primary);
}

.modal-header h3 i,
.tool-modal-title i {
    color: var(--color-primary);
    font-size: var(--font-size-lg);
}

.tool-modal-close {
    width: 36px;
    height: 36px;
    background: var(--color-dark-gray);
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-light-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-modal-close:hover {
    background: var(--color-primary);
    color: var(--color-white);
}

.modal-body,
.tool-modal-body {
    padding: var(--space-xl);
}

/* Export Buttons */
.export-option-group {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-dark-gray);
}

.export-option-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.export-option-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-white);
    margin-bottom: var(--space-md);
}

.export-option-label i {
    color: var(--color-primary);
}

.export-format-buttons {
    display: flex;
    gap: var(--space-md);
}

.export-format-buttons .btn {
    flex: 1;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    border: none;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-white);
    border: 1px solid rgba(255, 77, 41, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.01);
    color: var(--color-white);
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-slow);
    z-index: -1;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    transform: translateY(-2px) scale(1.01);
}

.export-option-group .btn-primary {
    width: 100%;
    justify-content: center;
}

/* History List */
.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--color-dark-gray);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-item:hover {
    background: var(--color-primary-light);
}

/* Modal Footer */
.modal-footer {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-xl);
    border-top: 1px solid var(--color-dark-gray);
}

.modal-footer .btn {
    flex: 1;
}

.modal-footer .btn-secondary i {
    color: var(--color-primary);
}

.history-info {
    flex: 1;
}

.history-ip {
    font-weight: 600;
    color: var(--color-white);
    font-family: var(--font-mono);
}

.history-date {
    font-size: var(--font-size-xs);
    color: var(--color-gray);
}

.history-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

/* Load button - secondary style */
.history-btn {
    height: 36px;
    padding: 0 var(--space-md);
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-xs);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-btn:hover {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    transform: translateY(-2px) scale(1.01);
}

/* Delete button - trash icon style */
.history-delete-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(231, 76, 60, 0.12);
    border: 1px solid rgba(231, 76, 60, 0.18);
    border-radius: var(--radius-md);
    color: rgba(231, 76, 60, 0.9);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

.history-delete-btn:hover {
    background: rgba(231, 76, 60, 0.15);
    border-color: rgba(231, 76, 60, 0.25);
    color: #e74c3c;
    transform: translate3d(0, -2px, 0) scale3d(1.01, 1.01, 1);
}

/* Notification Styles */
#notification-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.notification {
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    animation: slideIn 0.3s ease;
    max-width: 300px;
    color: white;
    font-weight: 500;
    pointer-events: all;
}

.notification-success {
    background: var(--color-success);
}

.notification-error {
    background: var(--color-error);
}

.notification-warning {
    background: var(--color-warning);
}

.notification-info {
    background: var(--color-info);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* CIDR Reference Table */
.cheat-sheet-header {
    padding: 0 0 var(--space-lg) 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
}

.cheat-sheet-header h4 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-md);
    color: var(--color-white);
    margin: 0;
}

.cheat-sheet-header i {
    color: var(--color-primary);
}

.cheat-sheet-description {
    padding: 0 0 var(--space-lg) 0;
    color: var(--color-light-gray);
    font-size: var(--font-size-sm);
    text-align: center;
}

.cheat-table-wrapper {
    padding: 0;
    overflow-x: auto;
}

.cheat-grid {
    display: flex;
    gap: var(--space-xl);
    font-size: var(--font-size-xs);
    overflow-x: auto;
}

.cheat-group {
    flex: 1;
    min-width: 180px;
}

.cheat-header {
    display: grid;
    grid-template-columns: 1fr 2fr 1.5fr;
    margin-bottom: 2px;
}

.cheat-th {
    padding: var(--space-xs) var(--space-sm);
    text-align: center;
    font-weight: 600;
    color: var(--color-white);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--color-dark-gray);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.cheat-section-label {
    padding: var(--space-sm);
    text-align: center;
    font-weight: 700;
    color: var(--color-primary);
    background: var(--color-primary-light);
    margin: 0 0 var(--space-sm) 0;
    border-radius: var(--radius-sm);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cheat-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1.5fr;
    margin-bottom: 2px;
}

.cheat-cell {
    padding: var(--space-xs) var(--space-sm);
    text-align: center;
    border: 1px solid var(--color-dark-gray);
    color: var(--color-light-gray);
    font-family: var(--font-primary);
    white-space: nowrap;
    font-size: 11px;
}

.cheat-cell.cidr {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 700;
    font-size: var(--font-size-sm);
}

.cheat-row:hover .cheat-cell {
    background: var(--color-dark-gray);
    color: var(--color-white);
}

.cheat-row:hover .cheat-cell.cidr {
    background: var(--color-primary);
    color: var(--color-white);
}

/* Reset Stats Button */
.reset-stats-btn {
    height: 32px;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0 var(--space-md);
    background: var(--glass-bg-secondary);
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reset-stats-btn i {
    color: var(--text-secondary);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.reset-stats-btn:hover {
    background: linear-gradient(135deg, var(--color-error) 0%, var(--color-error) 100%);
    border-color: var(--color-error);
    color: var(--color-white);
    transform: translateY(-1px);
}

.reset-stats-btn:hover i {
    color: var(--color-white);
}

/* Responsive Design */
@media (max-width: 900px) {
    .quick-stats-bar {
        grid-template-columns: repeat(6, 1fr);
    }

    .quick-stat:nth-child(1),
    .quick-stat:nth-child(2),
    .quick-stat:nth-child(3) {
        grid-column: span 2;
    }

    .quick-stat:nth-child(4),
    .quick-stat:nth-child(5) {
        grid-column: span 3;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .export-buttons {
        grid-template-columns: 1fr;
    }
    
    .modal-container {
        max-width: 90%;
        padding: 16px;
        border-radius: var(--radius-md);
    }
    
    .modal-header h3 {
        font-size: 24px;
    }
}

@media (max-width: 900px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .binary-item {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .binary-label {
        margin-bottom: var(--space-xs);
    }
}

@media (max-width: 768px) {
    .mode-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    .mode-btn {
        flex-direction: row;
        gap: var(--space-sm);
        justify-content: flex-start;
        padding: var(--space-sm) var(--space-md);
        min-height: 60px;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    .mode-icon {
        width: 32px;
        height: 32px;
        font-size: var(--font-size-md);
    }

    .mode-content {
        text-align: left;
    }

    .mode-title {
        font-size: var(--font-size-xs);
    }

    .mode-desc {
        font-size: 10px;
    }

    .auto-calculate-section {
        flex-direction: column;
        gap: var(--space-md);
        align-items: stretch;
    }

    .calculate-btn {
        width: 100%;
    }

    .auto-calculate-stats {
        justify-content: center;
    }

    .tool-container,
    .wide-container {
        padding: 0 var(--space-md);
    }
    
    .hero {
        margin-top: -var(--space-lg);
        margin-bottom: var(--space-sm);
    }
    
    .hero-title {
        font-size: var(--font-size-lg);
    }
    
    .hero-description {
        font-size: var(--font-size-xs);
    }
    
    .content-wrapper {
        padding: var(--space-md);
    }
    
    .quick-stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-stat {
        padding: var(--space-md);
    }
    
    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: var(--font-size-base);
    }
    
    .stat-value {
        font-size: var(--font-size-sm);
    }
    
    .text-tools-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .text-tool-btn.special {
        margin-left: var(--space-sm);
    }
    
    .input-grid {
        grid-template-columns: 1fr;
    }
    
    .input-with-dropdown {
        flex-direction: column;
    }
    
    .cidr-select {
        width: 100%;
    }
    
    .stats-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1 1 calc(50% - var(--space-sm));
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .binary-item {
        grid-template-columns: 100px 1fr auto;
        gap: var(--space-sm);
        padding: var(--space-md);
    }

    .binary-label {
        font-size: 11px;
    }

    .binary-decimal {
        font-size: var(--font-size-sm);
    }

    .binary-value {
        font-size: 11px;
    }

    .bit-octets {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--space-xs);
    }

    .bit-octet {
        min-width: 60px;
        padding: var(--space-xs);
    }

    .bit-octet-decimal {
        font-size: var(--font-size-base);
    }

    .bit-octet-binary {
        font-size: 8px;
    }

    .bit-ruler-network,
    .bit-ruler-host {
        font-size: 9px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .feature-card {
        padding: var(--space-lg);
    }
    
    .feature-icon {
        width: 48px;
        height: 48px;
        font-size: var(--font-size-lg);
    }
    
    .feature-card h3 {
        font-size: var(--font-size-md);
    }
    
    .feature-card p {
        font-size: var(--font-size-sm);
    }
    
    .faq-question {
        padding: var(--space-lg);
    }
    
    .faq-answer-content {
        padding: 0 var(--space-lg) var(--space-lg);
    }
    
    .modal-content {
        width: 95%;
    }
    
    .subnet-item {
        grid-template-columns: 1fr;
        gap: var(--space-xs);
    }
    
    .usage-steps-horizontal {
        flex-direction: column;
        gap: var(--space-lg);
    }
    
    .step-arrow {
        transform: rotate(90deg);
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .quick-stats-bar {
        grid-template-columns: minmax(0, 1fr);
    }

    .quick-stat:nth-child(1),
    .quick-stat:nth-child(2),
    .quick-stat:nth-child(3),
    .quick-stat:nth-child(4),
    .quick-stat:nth-child(5) {
        order: unset;
        grid-column: auto;
    }

    .hero {
        padding: var(--space-xs) 0;
        margin-bottom: var(--space-sm);
        margin-top: -var(--space-xl);
    }

    .hero-title {
        font-size: var(--font-size-md);
    }

    .content-wrapper {
        padding: var(--space-sm);
    }

    .binary-item {
        grid-template-columns: 80px 1fr auto;
    }

    .bit-octets {
        grid-template-columns: repeat(4, 1fr);
    }

    .bit-octet {
        min-width: 50px;
    }

    .bit-octet-decimal {
        font-size: var(--font-size-sm);
    }

    .bit-octet-binary {
        font-size: 7px;
    }
    
    .faq-question {
        padding: var(--space-md);
    }
    
    .faq-question h3 {
        font-size: var(--font-size-sm);
    }
    
    .step-icon {
        width: 60px;
        height: 60px;
    }
    
    .step-icon i {
        font-size: 1.125rem;
    }
    
    .usage-step h4 {
        font-size: var(--font-size-base);
    }
    
    .usage-step p {
        font-size: var(--font-size-xs);
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
    }
}

/* Print Styles */
@media print {
    .modal,
    .btn,
    .faq-section,
    .bg-animation,
    .text-tool-btn,
    .export-btn,
    .stats-tabs {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .content-wrapper,
    .feature-card {
        border: 1px solid #ccc;
        background: white;
        color: black;
        break-inside: avoid;
    }
    
    .hero-title,
    .section-header h2 {
        color: black;
    }
    
    .stat-value,
    .stat-number {
        color: #333;
    }
}
/* ============================================
   TOOL TABS (Favorites)
   ============================================ */
.tool-tabs {
    position: absolute;
    top: -44px;
    right: 64px;
    display: flex;
    gap: var(--space-sm);
    z-index: 5;
}

.tool-tab {
    position: relative;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}

.tool-tab i {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-tab:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 77, 41, 0.3);
}

.tool-tab:hover i {
    color: var(--color-primary);
}

.tool-tab.active i {
    color: #E74C3C;
}

.mobile-action-group {
    display: none;
}

.mobile-divider {
    display: none;
}

.mobile-group-label {
    display: none;
}

.mobile-action-btn {
    display: none;
}

@media (max-width: 768px) {
    .tool-tabs {
        top: -38px;
        right: 48px;
    }

    .tool-tab {
        width: 38px;
        height: 38px;
    }
}

/* TABLET OPTIMIZATION (769px-900px) - Keep usage steps and quick features in one row */
@media (max-width: 900px) and (min-width: 769px) {
    /* How to use steps - 4 in one row on tablet */
    .usage-steps-horizontal {
        display: flex;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: flex-start;
        gap: var(--space-lg);
    }

    .usage-step {
        flex: 1;
        max-width: 180px;
        text-align: center;
        align-items: center;
    }

    /* Quick features - single row on tablet */
    .quick-features {
        display: flex;
        flex-wrap: nowrap;
        gap: var(--space-sm);
    }

    .quick-feature {
        flex: 1;
        min-width: 0;
        padding: var(--space-sm);
    }

    .quick-feature span {
        font-size: 11px;
        line-height: 1.2;
    }
}

/* MOBILE OPTIMIZATION */

@media (max-width: 900px) {
    .hero {
        padding: var(--space-xs) var(--space-md);
    }

    .hero-title {
        font-size: var(--font-size-lg);
    }

    .hero-description {
        font-size: var(--font-size-sm);
    }

    .content-wrapper {
        padding: var(--space-xl);
    }

    .section-header h2 {
        font-size: var(--font-size-lg);
    }

    .section-header p {
        font-size: var(--font-size-sm);
    }

    .docs-link-btn {
        height: 28px;
        padding: 0 var(--space-sm);
        font-size: 10px;
        border-radius: var(--radius-md);
    }

    .docs-link-full {
        display: none;
    }

    .docs-link-short {
        display: inline;
    }

    .tool-tabs {
        right: 48px;
        top: -40px;
    }

    .tool-tab {
        width: 40px;
        height: 40px;
    }

    .tool-tab i {
        font-size: 16px;
    }

    .usage-steps-horizontal {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: flex-start;
        gap: var(--space-lg);
    }

    .step-arrow {
        display: flex;
        align-items: center;
        margin-top: 28px;
    }

    .usage-step {
        max-width: 160px;
        text-align: center;
        align-items: center;
    }

    .usage-step h4 {
        font-size: var(--font-size-sm);
    }

    .usage-step p {
        font-size: var(--font-size-xs);
    }

    .quick-features {
        display: flex;
        flex-wrap: nowrap;
        gap: var(--space-xs);
    }

    .quick-feature {
        flex: 1;
        min-width: 0;
        padding: var(--space-sm);
    }

    .quick-feature span {
        font-size: 11px;
        line-height: 1.2;
    }
}

@media (max-width: 768px) {
    body {
        background: linear-gradient(180deg, #05204b 0%, #031127 100%);
    }

    .page-layout {
        padding: 0 var(--space-md);
        padding-bottom: 60px;
        transform: none;
    }

    .main-content {
        transform: none;
        contain: none;
        will-change: auto;
        background: radial-gradient(circle at 15% 10%, rgb(255 77 41 / 0%) -2%, transparent 30%),
                    radial-gradient(circle at 70% 85%, rgba(0, 85, 164, 0.12) 0%, transparent 55%);
    }

    .tool-container {
        padding: 0 var(--space-sm);
    }

    .hero {
        padding: var(--space-xs) var(--space-sm);
        margin-bottom: var(--space-md);
        transform: none;
        contain: none;
    }

    .tool-tabs {
        display: flex;
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 56px;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 6px;
        padding: 0 var(--space-xs);
        background:
            linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.02) 100%),
            linear-gradient(135deg, rgba(5,20,45,0.95) 0%, rgba(3,16,36,0.92) 50%, rgba(10,25,50,0.95) 100%);
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        border-bottom: none;
        z-index: 1000;
    }

    .tool-tab {
        width: 40px;
        height: 40px;
        border-radius: var(--radius-md);
        border: 1px solid rgba(255, 255, 255, 0.15);
        background: rgba(255, 255, 255, 0.08);
        cursor: pointer;
        pointer-events: auto;
        flex-shrink: 0;
    }

    .tool-tab:active {
        background: rgba(255, 255, 255, 0.15);
    }

    .tool-tab:focus,
    .tool-tab:focus-visible {
        outline: none;
        border-color: rgba(255, 255, 255, 0.15);
    }

    .tool-tab i {
        font-size: 16px;
    }

    .mobile-action-group {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .mobile-group-label {
        display: none;
    }

    .mobile-divider {
        display: block;
        flex-shrink: 0;
        width: 1px;
        min-width: 1px;
        height: 32px;
        background: rgba(255, 255, 255, 0.2);
        margin: 0 2px;
    }

    .mobile-action-btn {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-md);
        border: 1px solid rgba(255, 255, 255, 0.15);
        background: rgba(255, 255, 255, 0.08);
        cursor: pointer;
        pointer-events: auto;
        flex-shrink: 0;
        color: rgba(255, 255, 255, 0.8);
    }

    .mobile-action-btn:active {
        background: rgba(255, 255, 255, 0.15);
    }

    .mobile-action-btn:focus,
    .mobile-action-btn:focus-visible {
        outline: none;
    }

    .mobile-action-btn i {
        font-size: 16px;
    }

    .mobile-action-btn .tool-label {
        font-size: 16px;
        font-weight: 700;
        color: rgba(255, 255, 255, 0.8);
    }

    .mobile-action-btn[data-action="clear"] {
        background: rgba(231, 76, 60, 0.12);
        border: 1px solid rgba(231, 76, 60, 0.15);
    }
    .mobile-action-btn[data-action="clear"] i {
        color: rgba(231, 76, 60, 0.9);
    }
    .mobile-action-btn[data-action="clear"]:active {
        background: rgba(231, 76, 60, 0.2);
    }

    .mobile-action-btn[data-action="download"] {
        background: rgba(52, 152, 219, 0.12);
        border: 1px solid rgba(52, 152, 219, 0.15);
    }
    .mobile-action-btn[data-action="download"] i {
        color: rgba(52, 152, 219, 0.9);
    }
    .mobile-action-btn[data-action="download"]:active {
        background: rgba(52, 152, 219, 0.2);
    }

    .ipv4-only {
        display: flex;
    }

    .ipv6-only {
        display: none;
    }

    body.ipv6-mode .ipv4-only {
        display: none;
    }

    body.ipv6-mode .ipv6-only {
        display: flex;
    }

    body.ipv6-mode #ipv4InputGroup {
        display: none;
    }

    .text-tools-bar {
        display: none;
    }

    .hero-title {
        font-size: var(--font-size-base);
    }

    .hero-description {
        font-size: var(--font-size-xs);
        max-width: 100%;
    }

    .content-wrapper {
        padding: var(--space-lg);
        border-radius: var(--radius-md);
    }

    .mode-buttons-integrated {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    .mode-btn-integrated {
        flex: 1 1 calc(50% - var(--space-sm) / 2);
        min-width: calc(50% - var(--space-sm) / 2);
        max-width: none;
        padding: var(--space-sm) var(--space-md);
        min-height: 44px;
    }

    .mode-icon-integrated {
        width: 36px;
        height: 36px;
    }

    .mode-icon-integrated i {
        font-size: 14px;
    }

    .mode-title-integrated {
        font-size: var(--font-size-xs);
    }

    .mode-desc-integrated {
        font-size: 10px;
    }

    .quick-stats-bar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto auto auto;
        gap: var(--space-sm);
        margin-bottom: var(--space-lg);
        padding-bottom: var(--space-md);
        overflow: hidden;
    }

    .quick-stat {
        padding: var(--space-sm);
        gap: var(--space-sm);
        overflow: hidden;
        min-width: 0;
    }

    .quick-stat:nth-child(1) {
        order: 5;
        grid-column: 1 / -1;
    }

    .quick-stat:nth-child(2) {
        order: 1;
        grid-column: auto;
    }

    .quick-stat:nth-child(3) {
        order: 2;
        grid-column: auto;
    }

    .quick-stat:nth-child(4) {
        order: 3;
        grid-column: auto;
    }

    .quick-stat:nth-child(5) {
        order: 4;
        grid-column: auto;
    }

    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: var(--font-size-sm);
        flex-shrink: 0;
    }

    .stat-content {
        min-width: 0;
        overflow: hidden;
        flex: 1;
    }

    .stat-value {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        display: block;
    }

    .stat-label {
        font-size: 8px;
    }

    .mode-label {
        font-size: 14px;
    }

    .input-label,
    .input-labels-row .input-label {
        font-size: 12px;
    }

    .input-hint {
        text-align: left;
    }

    .ipv6-prefix-select {
        font-size: var(--font-size-sm);
    }

    #ipv6InputGroup:not(.hidden) {
        display: flex;
        flex-direction: column;
        gap: var(--space-xs);
    }

    #ipv6InputGroup .input-labels-row {
        display: block;
        order: 1;
    }

    #ipv6InputGroup .ipv6-prefix-select {
        order: 2;
    }

    #ipv6InputGroup .input-hint {
        order: 3;
        margin-top: var(--space-xs);
    }

    #ipv4InputGroup {
        display: flex;
        flex-direction: column;
        gap: var(--space-xs);
    }

    .input-labels-row {
        display: contents;
    }

    .input-labels-row label:first-child {
        order: 1;
    }

    .input-labels-row label:last-child {
        order: 3;
        margin-top: var(--space-sm);
    }

    .input-with-dropdown {
        display: contents;
    }

    .text-input,
    .subnet-input {
        font-size: var(--font-size-sm);
    }

    .input-with-dropdown .text-input {
        order: 2;
        width: 100%;
    }

    .cidr-select {
        order: 4;
        width: 100%;
    }

    #ipv4InputGroup .input-hint {
        order: 5;
        margin-top: var(--space-xs);
    }

    .auto-calculate-section {
        display: none;
    }

    .stats-tabs {
        display: flex;
        flex-wrap: nowrap;
        gap: var(--space-xs);
    }

    .tab-btn {
        flex: 1;
        padding: var(--space-sm);
        font-size: var(--font-size-xs);
        white-space: nowrap;
        justify-content: center;
    }

    .tab-btn i {
        font-size: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .stat-card {
        padding: var(--space-sm);
    }

    .stat-icon-wrapper {
        width: 32px;
        height: 32px;
    }

    .stat-icon-wrapper i {
        font-size: 14px;
    }

    .stat-info {
        min-width: 0;
        overflow: hidden;
    }

    .stat-info .stat-title {
        font-size: 9px;
    }

    .stat-info .stat-number {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .stat-copy-btn {
        width: 28px;
        height: 28px;
    }

    .section-header {
        margin-bottom: var(--space-md);
    }

    .section-header h2 {
        font-size: var(--font-size-sm);
    }

    .section-header p {
        font-size: var(--font-size-xs);
    }

    .analytics-header {
        flex-direction: row;
        text-align: left;
        justify-content: space-between;
        align-items: center;
    }

    .analytics-header h4 {
        font-size: var(--font-size-sm);
    }

    .reset-stats-btn {
        width: auto;
        height: 28px;
        padding: 0 var(--space-sm);
        font-size: var(--font-size-xs);
        border-radius: var(--radius-md);
    }

    .analytics-card {
        padding: var(--space-sm);
    }

    .analytics-icon {
        width: 36px;
        height: 36px;
    }

    .analytics-icon i {
        font-size: var(--font-size-sm);
    }

    .analytics-value {
        font-size: var(--font-size-base);
    }

    .analytics-label {
        font-size: 9px;
    }

    .subnets-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
        margin-bottom: var(--space-md);
    }

    .subnets-header h4 {
        font-size: var(--font-size-sm);
        text-align: left;
    }

    .subnet-controls {
        display: flex;
        flex-direction: row;
        gap: var(--space-sm);
        width: 100%;
    }

    .subnet-count-input {
        flex: 1;
        width: auto;
        min-width: 0;
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--font-size-xs);
    }

    .subnet-generate-btn {
        flex-shrink: 0;
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-size-xs);
        gap: var(--space-xs);
        border-radius: var(--radius-md);
    }

    .subnet-generate-btn i {
        font-size: 12px;
    }

    .subnet-list {
        max-height: 300px;
        gap: var(--space-xs);
        padding-right: var(--space-xs);
    }

    .subnet-item {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
        gap: var(--space-xs) var(--space-sm);
        padding: var(--space-sm);
        font-size: var(--font-size-xs);
    }

    .subnet-number {
        grid-column: 1;
        grid-row: 1 / 3;
        align-self: center;
        font-size: 11px;
        padding-right: var(--space-xs);
        border-right: 1px solid rgba(255, 255, 255, 0.1);
    }

    .subnet-network {
        grid-column: 2;
        grid-row: 1;
        font-size: clamp(10px, 3vw, 12px);
    }

    .subnet-range {
        grid-column: 2;
        grid-row: 2;
        font-size: clamp(9px, 2.5vw, 11px);
        color: rgba(255, 255, 255, 0.6);
    }

    .subnet-broadcast {
        display: none;
    }

    .subnet-hosts {
        grid-column: 3;
        grid-row: 1 / 3;
        align-self: center;
        font-size: 10px;
        text-align: right;
        white-space: nowrap;
    }

    .cheat-sheet-header h4 {
        font-size: 14px;
    }

    .usage-compact {
        margin-top: var(--space-lg);
        gap: 0;
    }

    .usage-steps-horizontal {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
        justify-items: center;
    }

    .usage-steps-horizontal .usage-step:last-child {
        grid-column: 1 / -1;
        justify-self: center;
        margin-top: var(--space-sm);
    }

    .usage-step {
        align-items: center;
        text-align: center;
    }

    .step-arrow {
        display: none;
    }

    .step-icon {
        width: 56px;
        height: 56px;
    }

    .step-icon i {
        font-size: 1.125rem;
    }

    .usage-step h4 {
        font-size: var(--font-size-sm);
    }

    .usage-step p {
        font-size: var(--font-size-xs);
    }

    .quick-features {
        display: flex;
        flex-wrap: nowrap;
        gap: var(--space-xs);
    }

    .quick-feature {
        flex: 1;
        padding: var(--space-sm);
        flex-direction: column;
        text-align: center;
    }

    .quick-feature i {
        font-size: var(--font-size-sm);
    }

    .quick-feature span {
        font-size: 9px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .feature-card {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 0 var(--space-md);
        text-align: left;
        padding: var(--space-md);
        align-items: start;
    }

    .feature-icon {
        grid-row: 1 / 3;
        align-self: center;
        width: 44px;
        height: 44px;
    }

    .feature-card h3 {
        grid-column: 2;
        grid-row: 1;
        font-size: var(--font-size-sm);
        margin-bottom: 0;
    }

    .feature-card p {
        grid-column: 2;
        grid-row: 2;
        font-size: var(--font-size-xs);
        margin: 0;
    }

    .faq-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .faq-question {
        min-height: 44px;
    }

    .faq-question h3 {
        font-size: var(--font-size-sm);
    }

    .modal-container {
        width: 95%;
        max-width: none;
        max-height: 85vh;
        margin: var(--space-md);
    }

    .modal-header {
        padding: var(--space-md);
    }

    .modal-header h3 {
        font-size: var(--font-size-base);
        gap: var(--space-sm);
    }

    .modal-header h3 i {
        font-size: var(--font-size-base);
    }

    .modal-body {
        padding: var(--space-md);
    }

    .history-list {
        max-height: 50vh;
        gap: var(--space-sm);
    }

    .history-item {
        padding: var(--space-sm);
        flex-wrap: wrap;
        gap: var(--space-xs);
    }

    .history-info {
        flex: 1 1 100%;
        min-width: 0;
    }

    .history-ip {
        font-size: var(--font-size-xs);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        max-width: 100%;
    }

    .history-date {
        font-size: 10px;
    }

    .history-actions {
        flex: 0 0 auto;
        margin-left: auto;
    }

    .history-btn {
        height: 32px;
        padding: 0 var(--space-sm);
        font-size: 10px;
    }

    .history-delete {
        width: 32px;
        height: 32px;
    }

    .modal-footer {
        padding: var(--space-md);
        gap: var(--space-sm);
    }

    .modal-footer .btn {
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-size-xs);
        min-height: 40px;
    }

    .modal-footer .btn-secondary {
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
    }

    .modal-footer .btn-primary {
        background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    }

    .export-option-group {
        margin-bottom: var(--space-lg);
    }

    .export-option-label {
        font-size: var(--font-size-xs);
        margin-bottom: var(--space-sm);
    }

    .export-format-buttons {
        gap: var(--space-xs);
    }

    .export-format-buttons .btn {
        padding: var(--space-sm);
        font-size: var(--font-size-xs);
        min-height: 36px;
    }
}

@media (max-width: 480px) {
    .page-layout {
        padding: 0 var(--space-sm);
    }

    .tool-container {
        padding: 0 var(--space-xs);
    }

    .hero {
        padding: 0 var(--space-xs);
        margin-bottom: var(--space-md);
    }

    .hero-title {
        font-size: var(--font-size-sm);
        font-weight: 800;
    }

    .hero-description {
        font-size: 11px;
        line-height: 1.4;
    }

    .content-wrapper {
        padding: var(--space-md);
        border-radius: var(--radius-md);
    }

    .mode-buttons-integrated {
        gap: var(--space-xs);
    }

    .mode-btn-integrated {
        flex: 1 1 calc(50% - var(--space-xs) / 2);
        min-width: calc(50% - var(--space-xs) / 2);
        padding: var(--space-xs) var(--space-sm);
    }

    .mode-icon-integrated {
        width: 32px;
        height: 32px;
    }

    .mode-icon-integrated i {
        font-size: 12px;
    }

    .mode-title-integrated {
        font-size: 11px;
    }

    .mode-desc-integrated {
        font-size: 9px;
    }

    .tool-tab {
        width: 36px;
        height: 36px;
    }

    .tool-tab i {
        font-size: 14px;
    }

    .section-header h2 {
        font-size: var(--font-size-sm);
    }

    .section-header p {
        font-size: 11px;
    }

    .analytics-header h4 {
        font-size: var(--font-size-xs);
    }

    .reset-stats-btn {
        height: 24px;
        padding: 0 var(--space-xs);
        font-size: 10px;
        border-radius: var(--radius-md);
    }

    .analytics-icon {
        width: 32px;
        height: 32px;
    }

    .analytics-icon i {
        font-size: var(--font-size-xs);
    }

    .analytics-value {
        font-size: var(--font-size-sm);
    }

    .analytics-label {
        font-size: 8px;
    }

    .usage-compact {
        margin-top: var(--space-md);
    }

    .usage-steps-horizontal {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
        justify-items: center;
    }

    .step-icon {
        width: 48px;
        height: 48px;
    }

    .step-icon i {
        font-size: 1rem;
    }

    .usage-step h4 {
        font-size: var(--font-size-xs);
    }

    .usage-step p {
        font-size: 10px;
    }

    .quick-feature {
        padding: var(--space-xs);
    }

    .quick-feature i {
        font-size: var(--font-size-xs);
    }

    .quick-feature span {
        font-size: 8px;
    }

    .features-grid {
        gap: var(--space-xs);
    }

    .feature-card {
        padding: var(--space-sm) var(--space-md);
        gap: 0 var(--space-sm);
    }

    .feature-icon {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .feature-card h3 {
        font-size: var(--font-size-xs);
        margin-bottom: 0;
    }

    .feature-card p {
        font-size: 11px;
        line-height: 1.3;
    }

    .faq-question {
        padding: var(--space-md);
    }

    .faq-question h3 {
        font-size: var(--font-size-xs);
    }

    .faq-answer-content {
        padding: 0 var(--space-md) var(--space-md);
    }

    .faq-answer-content p {
        font-size: var(--font-size-xs);
    }
}

@media (max-width: 375px) {
    .page-layout {
        padding: 0 var(--space-xs);
    }

    .tool-container {
        padding: 0;
    }

    .hero {
        margin-bottom: var(--space-sm);
    }

    .hero-title {
        font-size: var(--font-size-xs);
    }

    .hero-description {
        font-size: 10px;
    }

    .content-wrapper {
        padding: var(--space-sm);
    }

    .mode-buttons-integrated {
        gap: 4px;
    }

    .mode-btn-integrated {
        padding: var(--space-xs);
    }

    .mode-icon-integrated {
        width: 28px;
        height: 28px;
    }

    .mode-icon-integrated i {
        font-size: 11px;
    }

    .mode-title-integrated {
        font-size: 10px;
    }

    .mode-desc-integrated {
        display: none;
    }

    .tool-tabs {
        gap: var(--space-xs);
    }

    .tool-tab {
        width: 32px;
        height: 32px;
    }

    .tool-tab i {
        font-size: 12px;
    }

    .section-header h2 {
        font-size: var(--font-size-xs);
    }

    .section-header p {
        font-size: 10px;
    }

    .analytics-header h4 {
        font-size: 11px;
    }

    .reset-stats-btn {
        height: 22px;
        font-size: 9px;
        border-radius: var(--radius-md);
    }

    .analytics-icon {
        width: 28px;
        height: 28px;
    }

    .analytics-value {
        font-size: var(--font-size-xs);
    }

    .analytics-label {
        font-size: 7px;
    }

    .usage-compact {
        margin-top: var(--space-sm);
    }

    .step-icon {
        width: 40px;
        height: 40px;
    }

    .step-icon i {
        font-size: 0.875rem;
    }

    .usage-step h4 {
        font-size: 11px;
    }

    .usage-step p {
        font-size: 9px;
    }

    .quick-feature span {
        font-size: 7px;
    }

    .feature-card {
        padding: var(--space-xs) var(--space-sm);
    }

    .feature-icon {
        width: 32px;
        height: 32px;
    }

    .feature-card h3 {
        font-size: 11px;
    }

    .feature-card p {
        font-size: 10px;
    }

    .faq-question h3 {
        font-size: 11px;
    }

    .faq-answer-content p {
        font-size: 11px;
    }
}
