/**
 * وسيط الأعمال - Responsive Design & Animations
 * Shared across all pages for consistent UX
 */

/* ========================================
   UNIFIED NAVBAR (PUBLIC PAGES)
   ======================================== */

.main-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 10px rgba(0,0,0,.06);
    transition: all 0.3s ease;
}

.main-navbar.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-logo img {
    height: 36px;
    transition: transform 0.3s;
}

.nav-logo:hover img {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}

.nav-links a {
    padding: 0.5rem 1rem;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 0.5rem;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.nav-links a:hover {
    color: #1a5f7a;
    background: rgba(26,95,122,.06);
}

.nav-links a.active {
    color: #1a5f7a;
    background: rgba(26,95,122,.1);
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.nav-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 0.6rem;
    font-family: Cairo, sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.nav-btn-primary {
    background: linear-gradient(135deg, #1a5f7a, #2980b9);
    color: #fff;
}

.nav-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(26,95,122,.3);
}

.nav-btn-outline {
    border: 2px solid #e5e7eb;
    color: #374151;
    background: #fff;
}

.nav-btn-outline:hover {
    border-color: #1a5f7a;
    color: #1a5f7a;
}

.nav-mobile-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: none;
    background: #f3f4f6;
    border-radius: 0.6rem;
    cursor: pointer;
    font-size: 1.15rem;
    color: #374151;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    flex-shrink: 0;
}

.nav-mobile-toggle:hover {
    background: #1a5f7a;
    color: #fff;
}

.nav-mobile-menu {
    display: none;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    padding: 1rem 2rem 1.5rem;
}

.nav-mobile-menu.open {
    display: block;
    animation: fadeInDown 0.3s ease;
}

.nav-mobile-links {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.nav-mobile-links a {
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 0.6rem;
    transition: all 0.2s;
}

.nav-mobile-links a:hover,
.nav-mobile-links a.active {
    background: rgba(26,95,122,.08);
    color: #1a5f7a;
}

.nav-mobile-auth {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.nav-mobile-auth .nav-btn {
    flex: 1;
    justify-content: center;
    padding: 0.75rem;
}

/* Navbar body padding to prevent content hiding behind fixed navbar */
body:has(.main-navbar) {
    padding-top: 65px;
}

/* Fallback for browsers not supporting :has */
.has-navbar {
    padding-top: 65px;
}

@media (max-width: 992px) {
    .nav-links, .nav-auth {
        display: none;
    }
    .nav-mobile-toggle {
        display: flex;
        margin-right: auto;
    }
    .nav-container {
        padding: 0.65rem 1rem;
    }
}

/* ========================================
   ANIMATIONS & KEYFRAMES
   ======================================== */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(25px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes borderGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(26,95,122,.1); }
    50% { box-shadow: 0 0 20px rgba(26,95,122,.2); }
}

@keyframes progressBar {
    from { width: 0; }
}

/* ========================================
   ANIMATION UTILITY CLASSES
   ======================================== */

.animate-fadeInUp { animation: fadeInUp 0.6s ease forwards; opacity: 0; }
.animate-fadeInDown { animation: fadeInDown 0.5s ease forwards; opacity: 0; }
.animate-fadeInRight { animation: fadeInRight 0.6s ease forwards; opacity: 0; }
.animate-fadeInLeft { animation: fadeInLeft 0.6s ease forwards; opacity: 0; }
.animate-fadeIn { animation: fadeIn 0.5s ease forwards; opacity: 0; }
.animate-scaleIn { animation: scaleIn 0.4s ease forwards; opacity: 0; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* Staggered delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

/* ========================================
   SMOOTH TRANSITIONS
   ======================================== */

/* Cards hover effects */
.stat-card,
.card,
.project-card,
.review-card,
.quote-card,
.request-card,
.consultation-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,.08);
}

.card:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,.06);
}

/* Buttons micro-interactions */
.btn, button {
    transition: all 0.25s ease;
}

.btn:active, button:active {
    transform: scale(0.97);
}

.btn-primary:hover {
    box-shadow: 0 4px 15px rgba(26,95,122,.3);
}

.btn-success:hover {
    box-shadow: 0 4px 15px rgba(39,174,96,.3);
}

.btn-danger:hover {
    box-shadow: 0 4px 15px rgba(231,76,60,.3);
}

/* Links hover */
a {
    transition: color 0.2s ease, opacity 0.2s ease;
}

/* Form focus effects */
.form-control, input, select, textarea {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus, input:focus, select:focus, textarea:focus {
    border-color: #1a5f7a;
    box-shadow: 0 0 0 3px rgba(26,95,122,.1);
}

/* Sidebar nav items */
.nav-item, .menu-item {
    transition: all 0.25s ease;
}

.nav-item:hover, .menu-item:hover {
    padding-right: 1.75rem;
}

/* ========================================
   MOBILE MENU BUTTON
   ======================================== */

.menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: none;
    background: #f3f4f6;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    color: #2c3e50;
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover {
    background: #1a5f7a;
    color: #fff;
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ========================================
   RESPONSIVE - TABLETS (max-width: 992px)
   ======================================== */

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

    /* Sidebar transforms to slide-in drawer */
    .sidebar {
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(.4,0,.2,1);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: -10px 0 40px rgba(0,0,0,.2);
    }

    .main-content {
        margin-right: 0 !important;
    }

    /* Stats grid: 2 columns */
    .stats-grid, .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }

    /* Content grid: single column */
    .content-grid {
        grid-template-columns: 1fr !important;
    }

    /* Quote/request details: 2 columns */
    .quote-details, .request-details, .project-details, .consultation-details {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Portfolio grid: 2 columns */
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Top header padding */
    .top-header {
        padding: 1rem 1.25rem;
    }

    /* Page content padding */
    .page-content {
        padding: 1.25rem;
    }

    /* Table scroll */
    .data-table, table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Modal width */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 1rem;
    }
}

/* ========================================
   RESPONSIVE - MOBILE (max-width: 768px)
   ======================================== */

@media (max-width: 768px) {
    /* Stats grid: 2 columns on mobile, NOT single column */
    .stats-grid, .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }

    /* Form rows: single column */
    .form-row {
        grid-template-columns: 1fr !important;
    }

    /* Details: 2 columns still readable */
    .quote-details, .request-details, .project-details, .consultation-details {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Page content - keep decent padding */
    .page-content {
        padding: 1rem 1rem;
    }

    /* Top header */
    .top-header {
        padding: 0.85rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .top-header h4, .top-header h2 {
        font-size: 1.05rem;
    }

    /* Cards - keep good padding */
    .card-body {
        padding: 1.15rem;
    }

    .card-header {
        padding: 1rem 1.15rem;
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    /* Stat cards - keep them readable */
    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        font-size: 1.1rem;
    }

    .stat-info h3 {
        font-size: 1.3rem;
    }

    .stat-info p {
        font-size: 0.8rem;
    }

    /* Balance card */
    .balance-card {
        padding: 1.5rem;
    }

    .balance-info h2 {
        font-size: 1.75rem;
    }

    .balance-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Tabs */
    .tabs, .filter-bar {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .tab, .filter-tab {
        font-size: 0.82rem;
        padding: 0.5rem 1rem;
    }

    /* Messages */
    .message-content p {
        max-width: 200px;
    }

    /* Buttons */
    .btn-group {
        flex-wrap: wrap;
    }

    /* Rating summary */
    .rating-summary {
        flex-direction: column !important;
        text-align: center;
    }

    .hide-mobile {
        display: none;
    }

    /* Project items */
    .project-item {
        flex-wrap: wrap;
    }

    .project-budget {
        width: 100%;
        text-align: left;
        margin-top: 0.5rem;
    }

    /* Review cards */
    .review-card {
        padding: 1rem;
    }
}

/* ========================================
   RESPONSIVE - SMALL MOBILE (max-width: 480px)
   ======================================== */

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .page-content {
        padding: 0.85rem;
    }

    /* Keep 2-column stats even on small phones */
    .stats-grid, .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.6rem;
    }

    .stat-card {
        padding: 0.85rem;
        gap: 0.6rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
        border-radius: 10px;
    }

    .stat-info h3 {
        font-size: 1.15rem;
    }

    .stat-info p {
        font-size: 0.75rem;
    }

    /* Details: still 2 columns */
    .quote-details, .request-details, .project-details {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem;
    }

    .detail-box {
        padding: 0.6rem;
    }

    .detail-box .value {
        font-size: 0.85rem;
    }

    .detail-box .label {
        font-size: 0.7rem;
    }

    .btn {
        padding: 0.55rem 1rem;
        font-size: 0.82rem;
    }

    /* Registration type buttons: 2 columns */
    .user-types {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .type-btn {
        padding: 0.85rem;
    }

    .type-btn i {
        font-size: 1.3rem;
    }

    .type-btn h4 {
        font-size: 0.8rem;
    }

    /* Card headers */
    .card-header h3 {
        font-size: 0.95rem;
    }

    /* Balance card */
    .balance-info h2 {
        font-size: 1.5rem;
    }
}

/* ========================================
   PUBLIC PAGES RESPONSIVE
   ======================================== */

/* Navbar responsive */
@media (max-width: 992px) {
    .navbar {
        padding: 0.75rem 1rem;
    }

    .navbar .nav-links {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100vh;
        background: linear-gradient(180deg, #1a5f7a, #0d3d4d);
        flex-direction: column;
        padding: 5rem 2rem 2rem;
        z-index: 1001;
        box-shadow: -5px 0 30px rgba(0,0,0,.3);
        animation: slideInRight 0.35s ease;
    }

    .navbar .nav-links.open {
        display: flex;
    }

    .navbar .nav-links a {
        color: #fff !important;
        font-size: 1.05rem;
        padding: 0.75rem 0;
        border-bottom: 1px solid rgba(255,255,255,.1);
    }

    .navbar .nav-btns {
        display: flex;
        gap: 0.5rem;
    }

    .navbar .nav-btns .btn {
        padding: 0.5rem 0.85rem;
        font-size: 0.8rem;
    }

    /* Mobile nav toggle */
    .mobile-nav-toggle {
        display: flex !important;
        width: 42px;
        height: 42px;
        border: none;
        background: rgba(255,255,255,.1);
        border-radius: 10px;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        color: inherit;
        font-size: 1.2rem;
    }
}

/* Hero section responsive */
@media (max-width: 992px) {
    .hero {
        padding: 4rem 1.5rem 2rem;
    }

    .hero-content {
        flex-direction: column !important;
        text-align: center;
    }

    .hero-text h1 {
        font-size: 1.75rem;
    }

    .hero-visual {
        display: none;
    }

    .hero-stats {
        justify-content: center;
    }

    .hero-btns {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .hero-text h1 {
        font-size: 1.5rem;
    }

    .hero-stats {
        flex-wrap: wrap;
        gap: 1rem;
    }

    /* Section headers */
    .section-header h2 {
        font-size: 1.3rem;
    }

    /* Service cards grid */
    .services-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Contractor cards */
    .contractors-showcase {
        flex-direction: column;
        align-items: center;
    }

    .contractor-card {
        min-width: 100% !important;
    }

    /* Footer grid */
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    /* Tools grid */
    .tools-grid {
        grid-template-columns: 1fr !important;
    }

    /* Product cards in homepage */
    [style*="grid-template-columns:repeat(auto-fill"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .services-grid {
        grid-template-columns: 1fr !important;
    }

    .hero-text h1 {
        font-size: 1.3rem;
    }

    .section-header h2 {
        font-size: 1.15rem;
    }

    /* Product cards full width */
    [style*="grid-template-columns:repeat(auto-fill"] {
        grid-template-columns: 1fr !important;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.2);
    border-radius: 2px;
}

/* ========================================
   LOADING SKELETON
   ======================================== */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 12px;
}

/* ========================================
   TOAST / NOTIFICATION IMPROVEMENTS
   ======================================== */

.toast {
    animation: fadeInDown 0.4s ease, fadeIn 0.3s ease;
    backdrop-filter: blur(10px);
}

/* ========================================
   SMOOTH SCROLL
   ======================================== */

html {
    scroll-behavior: smooth;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .sidebar, .top-header, .menu-toggle, .nav-btns, .btn, button {
        display: none !important;
    }
    .main-content {
        margin: 0 !important;
    }
    .page-content {
        padding: 0 !important;
    }
}
