/* Tablet Styles */
@media (max-width: 1024px) {
    .container {
        padding: 0 15px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-description {
        font-size: 1.1rem;
    }

    .hero-stats {
        gap: 2rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--background);
        flex-direction: column;
        padding: 2rem;
        transition: var(--transition);
        box-shadow: var(--shadow);
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        opacity: 0;
        transform: translateY(10px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .nav-menu.active li {
        opacity: 1;
        transform: translateY(0);
    }

    .nav-menu.active li:nth-child(1) {
        transition-delay: 0.05s;
    }

    .nav-menu.active li:nth-child(2) {
        transition-delay: 0.10s;
    }

    .nav-menu.active li:nth-child(3) {
        transition-delay: 0.15s;
    }

    .nav-menu.active li:nth-child(4) {
        transition-delay: 0.20s;
    }

    .nav-menu.active li:nth-child(5) {
        transition-delay: 0.25s;
    }

    .nav-menu.active li:nth-child(6) {
        transition-delay: 0.30s;
    }

    .nav-menu li {
        margin: 1rem 0;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .tool-card {
        padding: 1.5rem;
    }

    .tool-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .calculator-buttons {
        gap: 0.3rem;
    }

    .calc-btn {
        height: 50px;
        font-size: 1.1rem;
    }

    .scientific-calculator .calculator-row {
        grid-template-columns: repeat(6, 1fr);
    }

    .scientific-calculator .calc-btn {
        font-size: 0.8rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* Mobile Styles */
@media (max-width: 480px) {
    .hero {
        padding: 3rem 0;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-description {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .category-title {
        font-size: 1.5rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .tool-card {
        padding: 1.5rem;
    }

    .tool-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .tool-card h3 {
        font-size: 1.1rem;
    }

    .tool-card p {
        font-size: 0.9rem;
    }

    .modal-header {
        padding: 1rem 1.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .form-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .calculator-display {
        height: 60px;
        font-size: 1.5rem;
    }

    .calc-btn {
        height: 45px;
        font-size: 1rem;
    }

    .scientific-calculator .calculator-row {
        grid-template-columns: repeat(4, 1fr);
    }

    .scientific-calculator .calc-btn {
        height: 40px;
        font-size: 0.7rem;
    }

    /* Table responsiveness for small screens */
    .amortization-table {
        font-size: 0.8rem;
    }

    .amortization-table th,
    .amortization-table td {
        padding: 0.3rem;
    }

    /* Currency converter responsiveness */
    .conversion-result {
        flex-direction: column;
        gap: 1rem;
    }

    .amount-display {
        justify-content: center;
    }

    .currency-pairs {
        justify-content: center;
    }

    .pair-btn {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }

    /* Time zone converter responsiveness */
    .time-conversion {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .time-arrow {
        transform: rotate(90deg);
    }

    .timezone-details {
        grid-template-columns: 1fr;
    }

    .conversion-buttons {
        grid-template-columns: 1fr;
    }

    /* Data size converter responsiveness */
    .conversion-display {
        flex-direction: column;
        gap: 1rem;
    }

    .from-value,
    .to-value {
        justify-content: center;
    }

    /* Text tools responsiveness */
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .progress-header,
    .progress-footer {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .barcode-lines {
        height: 50px;
    }

    .stat-card {
        padding: 0.5rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* Large Screen Styles */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }

    .hero-title {
        font-size: 3.5rem;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 2.5rem;
    }

    .tool-card {
        padding: 2.5rem;
    }

    .tool-icon {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .tool-icon {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 2rem 0;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .hero-description {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .modal-content {
        max-height: 95vh;
    }
}

/* Print Styles */
@media print {

    .header,
    .footer,
    .tool-modal,
    .theme-toggle,
    .search-toggle {
        display: none;
    }

    .hero {
        background: none;
        color: black;
    }

    .tool-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #333333;
        --background: #FFFFFF;
        --surface: #F0F0F0;
        --border-color: #000000;
    }

    .tool-card {
        border-width: 2px;
    }

    .btn {
        border-width: 2px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #FFFFFF;
        --text-secondary: #B0B0B0;
        --background: #121212;
        --surface: #1E1E1E;
        --border-color: #333333;
    }

    .tool-card {
        background: var(--surface);
    }

    .modal-content {
        background: var(--background);
    }

    .form-input,
    .form-select,
    .form-textarea {
        background: var(--surface);
        color: var(--text-primary);
    }

    .calc-btn {
        background: var(--surface);
        color: var(--text-primary);
    }
}