/* ============================================
   Additional Responsive Enhancements
   Specific fixes for invoice and form pages
   ============================================ */

/* Invoice Create/Edit Page Specific */
@media (max-width: 768px) {

    /* Editor Container */
    .editor-container {
        max-width: 100% !important;
        margin: 1rem auto !important;
        padding: 0 !important;
    }

    /* Invoice Paper */
    .invoice-paper {
        min-height: auto !important;
        padding: 1rem !important;
        border-radius: 0 !important;
    }

    /* Logo Upload Area */
    .logo-upload-area {
        width: 150px !important;
        height: 60px !important;
    }

    /* Invoice Title */
    .invoice-title {
        font-size: 2rem !important;
    }

    /* Meta Section Inputs */
    .meta-section input,
    .meta-section select {
        width: 120px !important;
        font-size: 0.875rem !important;
    }

    /* Client Grid */
    .client-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    /* Items Table - Make scrollable */
    .items-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        min-width: 100%;
    }

    .items-table thead,
    .items-table tbody,
    .items-table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    .items-table th,
    .items-table td {
        font-size: 0.75rem !important;
        padding: 0.5rem 0.25rem !important;
    }

    /* Totals Section */
    .totals-section-wrapper {
        justify-content: flex-start !important;
    }

    .totals-grid {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Invoice Footer */
    .invoice-footer {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    /* Signature Area */
    .signature-area {
        margin-top: 1rem !important;
    }

    /* Section Header */
    .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
        padding: 0 0.5rem !important;
    }

    .section-header h1 {
        font-size: 1.25rem !important;
    }

    .section-header .btn {
        width: 100% !important;
    }
}

/* Auth Pages Enhancements */
@media (max-width: 768px) {

    /* Login/Register Cards */
    .card {
        margin: 2rem 1rem !important;
        padding: 1.5rem !important;
    }

    /* Form Groups */
    .form-group {
        margin-bottom: 1rem !important;
    }

    /* Remember Me & Forgot Password */
    .form-group[style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }
}

/* Contact Page */
@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr !important;
    }

    .contact-form,
    .contact-info {
        padding: 1.5rem !important;
    }
}

/* Blog Pages */
@media (max-width: 768px) {
    .blog-grid {
        grid-template-columns: 1fr !important;
    }

    .blog-card {
        margin-bottom: 1.5rem !important;
    }

    .blog-content {
        padding: 1rem !important;
    }

    .blog-content h1 {
        font-size: 1.75rem !important;
    }

    .blog-content h2 {
        font-size: 1.5rem !important;
    }
}

/* Settings Page */
@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr !important;
    }

    .settings-card {
        padding: 1rem !important;
    }
}

/* Subscription/Upgrade Page */
@media (max-width: 768px) {
    .subscription-grid {
        grid-template-columns: 1fr !important;
    }

    .plan-card {
        margin-bottom: 1.5rem !important;
    }
}

/* Reports Page */
@media (max-width: 768px) {
    .reports-filters {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .reports-filters select,
    .reports-filters input {
        width: 100% !important;
    }
}

/* Billing History */
@media (max-width: 768px) {
    .billing-stats {
        grid-template-columns: 1fr !important;
    }

    .transaction-card {
        padding: 1rem !important;
    }
}

/* Invoice List/Index */
@media (max-width: 768px) {

    /* Hide less important columns */
    .table th:nth-child(3),
    .table td:nth-child(3) {
        display: none;
    }

    /* Make action buttons smaller */
    .table .btn {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.75rem !important;
    }

    /* Stack action buttons vertically */
    .table td[style*="text-align: right"]>div {
        flex-direction: column !important;
        gap: 0.25rem !important;
    }
}

/* Usage Bar (Free Plan) */
@media (max-width: 768px) {
    div[style*="display: flex"][style*="justify-content: space-between"] {
        flex-wrap: wrap !important;
    }

    div[style*="max-width: 200px"] {
        max-width: 100% !important;
        margin: 0.5rem 0 !important;
    }
}

/* Plan Cards on Dashboard */
@media (max-width: 768px) {
    .content-card[style*="border-left"] {
        padding: 1rem !important;
    }

    div[style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: 1fr !important;
    }
}

/* Alerts and Notifications */
@media (max-width: 768px) {
    .alert {
        padding: 0.75rem !important;
        font-size: 0.875rem !important;
    }

    #limit-toast {
        left: 1rem !important;
        right: 1rem !important;
        transform: none !important;
        bottom: 1rem !important;
    }
}

/* Badges */
@media (max-width: 768px) {
    .status-badge {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.5rem !important;
    }
}

/* Charts */
@media (max-width: 768px) {
    canvas {
        max-height: 250px !important;
    }

    div[style*="height: 300px"] {
        height: 200px !important;
    }

    div[style*="height: 250px"] {
        height: 180px !important;
    }
}

/* Improve touch targets */
@media (max-width: 768px) {

    a,
    button,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Increase padding for better touch */
    .nav-item,
    .unified-nav-link {
        padding: 1rem !important;
    }
}

/* Landscape orientation specific */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 30px 0 !important;
    }

    .hero-text h1 {
        font-size: 1.75rem !important;
    }

    .invoice-paper {
        padding: 1rem !important;
    }
}

/* Very small screens (< 360px) */
@media (max-width: 360px) {
    .container {
        padding: 0 0.75rem !important;
    }

    .hero-text h1 {
        font-size: 1.5rem !important;
    }

    .btn {
        font-size: 0.875rem !important;
        padding: 10px 14px !important;
    }

    .invoice-title {
        font-size: 1.5rem !important;
    }
}