/* Responsive Styles */

@media (max-width: 1024px) {
    .jobs-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.25rem;
    }
    
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .nav {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        background: white;
        box-shadow: var(--shadow-lg);
        transition: var(--transition);
        z-index: 999;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .nav.active {
        left: 0;
    }

    .nav ul {
        flex-direction: column;
        padding: 1.5rem;
        gap: 0.75rem;
        width: 100%;
    }
    
    .nav ul li {
        width: 100%;
    }
    
    .nav ul li a {
        padding: 0.75rem 1rem;
        border-radius: var(--radius);
        display: block;
        width: 100%;
    }
    
    .nav ul li a:hover {
        background: var(--bg-light);
    }

    .auth-links {
        flex-direction: column;
        margin-left: 0;
        width: 100%;
        gap: 0.75rem;
        margin-top: 0.5rem;
    }
    
    .auth-links .btn-login,
    .auth-links .btn-register {
        width: 100%;
    }

    .hero {
        padding: 1.5rem 0;
    }

    .hero-title {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    
    .search-box {
        padding: 0 1rem;
    }
    
    .search-form {
        padding: 1.25rem;
    }

    .search-input-group {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .section {
        padding: 1.5rem 0;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }
    
    .section-header h2 {
        font-size: 1.75rem;
    }

    .jobs-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .category-card {
        padding: 1.5rem 1rem;
    }
    
    .category-icon {
        font-size: 2.5rem;
    }

    .newsletter-form {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .newsletter-content h2 {
        font-size: 1.75rem;
    }
    
    .newsletter-content p {
        font-size: 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer {
        padding: 2.5rem 0 1rem;
    }
    
    .footer-col {
        text-align: center;
    }
    
    .footer-col h3,
    .footer-col h4 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .footer-col p {
        font-size: 0.85rem;
        line-height: 1.6;
    }
    
    .footer-col ul {
        align-items: center;
    }
    
    .footer-col a {
        font-size: 0.85rem;
        padding: 0.25rem 0;
    }
    
    .social-links {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .social-links a {
        padding: 0.5rem 0.875rem;
        font-size: 0.85rem;
    }
    
    .footer-bottom {
        padding-top: 1.5rem;
        font-size: 0.85rem;
    }
    
    .job-title {
        font-size: 1.1rem;
    }
    
    .job-company {
        font-size: 0.85rem;
    }
    
    .job-details {
        font-size: 0.85rem;
        gap: 0.75rem;
    }
    
    .job-description {
        font-size: 0.85rem;
    }
    
    .job-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
        white-space: nowrap;
    }
    
    .job-card-header {
        flex-wrap: nowrap;
        gap: 0.5rem;
    }
    
    /* Job Details Page Mobile Styles */
    .job-details-card {
        padding: 1rem;
        border-radius: var(--radius);
        margin-bottom: 1rem;
    }
    
    .job-details-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .job-details-title {
        font-size: 1.35rem;
        line-height: 1.3;
        margin-bottom: 0.25rem;
    }
    
    .job-details-company {
        font-size: 0.95rem;
    }
    
    .job-badge-large {
        font-size: 0.8rem;
        padding: 0.35rem 0.7rem;
    }
    
    .job-info-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1rem;
        margin-bottom: 1.25rem;
    }
    
    .job-info-item {
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .job-info-item:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .job-info-label {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }
    
    .job-info-value {
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    .job-description-section {
        margin-bottom: 1.25rem;
    }
    
    .job-description-title {
        font-size: 1.15rem;
        margin-bottom: 0.5rem;
    }
    
    .job-description-content {
        font-size: 0.85rem;
        line-height: 1.6;
    }
    
    .job-actions {
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1rem;
    }
    
    .btn-apply-large {
        width: 100%;
        text-align: center;
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
        white-space: normal;
        word-wrap: break-word;
        line-height: 1.3;
    }
    
    .btn-action {
        width: 100%;
        text-align: center;
        font-size: 0.85rem;
        padding: 0.65rem 1rem;
    }
    
    .back-link {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }
    
    .job-details-section {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .job-details-wrapper {
        padding: 0 0.5rem;
    }
    
    /* Reduce alert spacing on mobile */
    .alert {
        padding: 0.75rem 1rem !important;
        margin-bottom: 0.75rem !important;
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    /* Reduce paragraph spacing in job description */
    .job-description-content p {
        margin-bottom: 0.75rem;
    }
    
    .job-description-content p:last-child {
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 1.25rem 0;
    }

    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }

    .section {
        padding: 1.25rem 0;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
    }

    .categories-grid {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }
    
    .category-card {
        padding: 1.25rem 1rem;
    }
    
    .category-icon {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .category-card h3 {
        font-size: 1rem;
    }
    
    .category-card p {
        font-size: 0.85rem;
    }
    
    .job-card {
        padding: 1rem;
    }
    
    
    .container {
        padding: 0 1rem;
    }
    
    /* Reduce spacing in job details on mobile */
    .job-details-section .container {
        padding: 0 0.75rem;
    }
    
    .logo h1 {
        font-size: 1.1rem;
    }
    
    .logo img {
        height: 35px;
        max-width: 140px;
        object-fit: contain;
    }
    
    .logo a {
        display: flex;
        align-items: center;
    }
    
    .nav ul {
        padding: 1.25rem;
    }
    
    .search-form {
        padding: 1rem;
    }
    
    .newsletter-content h2 {
        font-size: 1.5rem;
    }
    
    .footer {
        padding: 2rem 0 1rem;
    }
    
    .footer-content {
        gap: 1.5rem;
    }
    
    .footer-col h3,
    .footer-col h4 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .footer-col p {
        font-size: 0.8rem;
    }
    
    .footer-col a {
        font-size: 0.8rem;
    }
    
    .social-links {
        gap: 0.5rem;
    }
    
    .social-links a {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .footer-bottom {
        padding-top: 1.25rem;
        font-size: 0.8rem;
        line-height: 1.5;
    }
}

@media (max-width: 360px) {
    .hero-title {
        font-size: 1.25rem;
    }
    
    .section-header h2 {
        font-size: 1.25rem;
    }
    
    .btn-primary,
    .btn-apply,
    .btn-search {
        font-size: 0.85rem;
        padding: 0.625rem 1.25rem;
    }
    
    .job-card {
        padding: 0.875rem;
    }
    
    .category-card {
        padding: 1rem 0.75rem;
    }
    
    /* Job Details Page Very Small Mobile */
    .job-details-card {
        padding: 0.875rem;
        border-radius: var(--radius);
        margin-bottom: 0.75rem;
    }
    
    .job-details-header {
        margin-bottom: 0.75rem;
        gap: 0.5rem;
    }
    
    .job-details-title {
        font-size: 1.2rem;
        margin-bottom: 0.25rem;
    }
    
    .job-details-company {
        font-size: 0.9rem;
    }
    
    .job-badge-large {
        font-size: 0.75rem;
        padding: 0.3rem 0.65rem;
    }
    
    .job-info-grid {
        padding: 0.875rem;
        gap: 0.625rem;
        margin-bottom: 1rem;
    }
    
    .job-info-item {
        padding-bottom: 0.625rem;
    }
    
    .job-info-label {
        font-size: 0.75rem;
        margin-bottom: 0.2rem;
    }
    
    .job-info-value {
        font-size: 0.8rem;
        line-height: 1.35;
    }
    
    .job-description-section {
        margin-bottom: 1rem;
    }
    
    .job-description-title {
        font-size: 1.05rem;
        margin-bottom: 0.4rem;
    }
    
    .job-description-content {
        font-size: 0.8rem;
        line-height: 1.5;
    }
    
    .job-actions {
        gap: 0.4rem;
        margin-top: 0.75rem;
    }
    
    .btn-apply-large {
        font-size: 0.8rem;
        padding: 0.65rem 0.875rem;
        line-height: 1.25;
    }
    
    .btn-action {
        font-size: 0.8rem;
        padding: 0.6rem 0.875rem;
    }
    
    .back-link {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }
    
    .job-details-section {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
    
    .job-details-wrapper {
        padding: 0 0.25rem;
    }
    
    /* Further reduce spacing on very small screens */
    .alert {
        padding: 0.625rem 0.875rem !important;
        margin-bottom: 0.625rem !important;
        font-size: 0.8rem;
    }
    
    .job-description-content p {
        margin-bottom: 0.625rem;
    }
    
    .footer {
        padding: 1.5rem 0 0.75rem;
    }
    
    .footer-content {
        gap: 1.25rem;
    }
    
    .footer-col h3,
    .footer-col h4 {
        font-size: 0.95rem;
    }
    
    .footer-col p,
    .footer-col a {
        font-size: 0.75rem;
    }
    
    .social-links a {
        padding: 0.35rem 0.65rem;
        font-size: 0.75rem;
    }
    
    .footer-bottom {
        font-size: 0.75rem;
        padding-top: 1rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn-primary,
    .btn-apply,
    .btn-search,
    .btn-login,
    .btn-register {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav ul li a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .mobile-menu-toggle {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Smooth scrolling for mobile */
@media (max-width: 768px) {
    html {
        scroll-padding-top: 60px;
    }
    
    * {
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.1);
    }
}

/* ============================================
   ADMIN PANEL RESPONSIVE STYLES
   ============================================ */

/* Admin Sidebar Mobile Toggle */
.admin-mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    position: fixed;
    top: 1rem;
    left: 1rem;
    color: white;
}

.admin-mobile-toggle span {
    width: 24px;
    height: 2.5px;
    background: currentColor;
    transition: var(--transition-fast);
    border-radius: 2px;
}

.admin-mobile-toggle:hover span {
    opacity: 0.8;
}

/* Admin Sidebar Responsive */
@media (max-width: 768px) {
    .admin-mobile-toggle {
        display: flex;
    }
    
    .admin-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: var(--transition);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .admin-sidebar.active {
        left: 0;
    }
    
    .admin-sidebar::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        opacity: 0;
        pointer-events: none;
        transition: var(--transition);
    }
    
    .admin-sidebar.active::before {
        opacity: 1;
        pointer-events: all;
    }
    
    .admin-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 4rem;
    }
    
    .admin-sidebar h2 {
        padding-top: 3.5rem;
        font-size: 1.25rem;
    }
    
    .admin-menu li a {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .admin-sidebar {
        width: 100%;
    }
    
    .admin-content {
        padding: 0.75rem;
        padding-top: 3.5rem;
    }
    
    .admin-mobile-toggle {
        top: 0.75rem;
        left: 0.75rem;
    }
}

/* Admin Stats Grid Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-card h3 {
        font-size: 1.75rem;
    }
    
    .stat-card p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card h3 {
        font-size: 1.5rem;
    }
}

/* Admin Tables Responsive - Convert to Cards */
@media (max-width: 768px) {
    .admin-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-table-container table {
        min-width: 600px;
    }
    
    /* Alternative: Card-based layout for better mobile UX */
    .admin-table-card-view {
        display: none;
    }
    
    .admin-table-container.mobile-view .admin-table-card-view {
        display: block;
    }
    
    .admin-table-container.mobile-view table {
        display: none;
    }
    
    .admin-card {
        background: white;
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: var(--shadow);
    }
    
    .admin-card-header {
        display: flex;
        justify-content: space-between;
        align-items: start;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .admin-card-title {
        font-weight: 600;
        color: var(--text-color);
        font-size: 1rem;
        margin: 0;
    }
    
    .admin-card-body {
        display: grid;
        gap: 0.75rem;
    }
    
    .admin-card-row {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .admin-card-label {
        font-size: 0.8rem;
        color: var(--text-light);
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .admin-card-value {
        font-size: 0.95rem;
        color: var(--text-color);
    }
    
    .admin-card-actions {
        display: flex;
        gap: 0.75rem;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border-color);
        flex-wrap: wrap;
    }
    
    .admin-card-actions button,
    .admin-card-actions a {
        flex: 1;
        min-width: 80px;
        text-align: center;
        padding: 0.5rem 1rem;
        border-radius: var(--radius);
        font-size: 0.85rem;
        text-decoration: none;
        border: none;
        cursor: pointer;
        transition: var(--transition-fast);
    }
}

/* Admin Forms Responsive */
@media (max-width: 768px) {
    .admin-content form {
        padding: 1.5rem !important;
    }
    
    .admin-content form > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }
    
    .admin-content h1 {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }
    
    .admin-content .container[style*="max-width"] {
        max-width: 100% !important;
    }
    
    /* Header with button responsive */
    .admin-content > .container > div[style*="display: flex"] {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
    
    .admin-content > .container > div[style*="display: flex"] h1 {
        margin-bottom: 0;
    }
    
    .admin-content > .container > div[style*="display: flex"] a,
    .admin-content > .container > div[style*="display: flex"] button {
        width: 100%;
    }
    
    .admin-content > .container > div[style*="display: flex"] > div[style*="display: flex"] {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }
    
    .admin-content > .container > div[style*="display: flex"] > div[style*="display: flex"] button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .admin-content form {
        padding: 1rem !important;
    }
    
    .admin-content h1 {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }
}

/* Admin Content Cards Responsive */
@media (max-width: 768px) {
    .admin-content > .container > div[style*="background: white"] {
        padding: 1.25rem !important;
        overflow-x: auto;
    }
    
    .admin-content > .container > div[style*="background: white"] h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
}

/* Admin Page Header Responsive */
.admin-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-page-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .admin-page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .admin-page-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .admin-page-actions button {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .admin-content > .container > div[style*="background: white"] {
        padding: 1rem !important;
    }
}

/* Filters Section Responsive */
@media (max-width: 768px) {
    .filters-section {
        padding: 1.25rem !important;
    }
    
    .filters-section form > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    .filters-section button {
        width: 100%;
    }
    
    .filters-section .form-group {
        margin-bottom: 1rem;
    }
}

/* Jobs Page Title Responsive */
@media (max-width: 768px) {
    .section h1[style*="font-size: 2.5rem"] {
        font-size: 1.75rem !important;
        margin-bottom: 1.5rem !important;
    }
}

@media (max-width: 480px) {
    .section h1[style*="font-size: 2.5rem"],
    .section h1[style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
        margin-bottom: 1.25rem !important;
    }
}

/* Jobs Page Title Responsive */
@media (max-width: 768px) {
    .section h1[style*="font-size: 2.5rem"] {
        font-size: 1.75rem !important;
        margin-bottom: 1.5rem !important;
    }
}

@media (max-width: 480px) {
    .section h1[style*="font-size: 2.5rem"],
    .section h1[style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
        margin-bottom: 1.25rem !important;
    }
}

/* Pagination Responsive */
@media (max-width: 768px) {
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .pagination button,
    .pagination a {
        min-width: 40px;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Apply Form Responsive */
@media (max-width: 768px) {
    .section > .container > div[style*="max-width: 700px"] {
        max-width: 100% !important;
    }
    
    .section > .container > div[style*="max-width: 700px"] > div[style*="background: var(--bg-light)"] {
        padding: 1.25rem !important;
    }
    
    .section > .container > div[style*="max-width: 700px"] form {
        padding: 1.5rem !important;
    }
}

@media (max-width: 480px) {
    .section > .container > div[style*="max-width: 700px"] > div[style*="background: var(--bg-light)"] {
        padding: 1rem !important;
    }
    
    .section > .container > div[style*="max-width: 700px"] form {
        padding: 1rem !important;
    }
}

/* Table Scroll Wrapper for Mobile */
@media (max-width: 768px) {
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    .table-wrapper table {
        min-width: 800px;
    }
}

/* Close sidebar when clicking outside on mobile */
@media (max-width: 768px) {
    .admin-sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: var(--transition);
    }
    
    .admin-sidebar-overlay.active {
        opacity: 1;
        pointer-events: all;
    }
}
