/* Mobile Responsive Design Enhancements */

/* Base responsive settings */
@media (max-width: 1200px) {
  .container {
    max-width: 960px;
  }
  
  .grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .top-info-bar .info-container {
    flex-wrap: wrap;
  }
  
  .top-info-bar .info-item {
    flex: 0 0 33.333%;
    margin-bottom: 5px;
  }
}

@media (max-width: 992px) {
  .container {
    max-width: 720px;
  }
  
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .navbar-container {
    padding: 0 15px;
  }
  
  .navbar-menu {
    position: fixed;
    top: 60px;
    left: -100%;
    width: 80%;
    max-width: 300px;
    height: calc(100vh - 60px);
    background-color: var(--bg-color);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    padding: 20px;
  }
  
  .navbar-menu.active {
    left: 0;
  }
  
  .navbar-toggle {
    display: flex;
  }
  
  .navbar-nav {
    flex-direction: column;
  }
  
  .navbar-nav li {
    margin: 0;
    width: 100%;
  }
  
  .navbar-nav .nav-link {
    padding: 12px 0;
    width: 100%;
    display: block;
  }
  
  .dropdown-menu {
    position: static;
    width: 100%;
    box-shadow: none;
    margin-top: 0;
    margin-bottom: 10px;
    padding: 0 0 0 15px;
    display: none;
  }
  
  .dropdown.active .dropdown-menu {
    display: block;
  }
  
  .dropdown-toggle {
    width: 100%;
    text-align: left;
    justify-content: space-between;
  }
  
  .navbar-right {
    margin-left: auto;
  }
  
  .search-container {
    display: none;
  }
  
  .navbar-right .btn {
    display: none;
  }
  
  .navbar-right .theme-toggle,
  .navbar-right .language-selector {
    margin-left: 10px;
  }
  
  .hero-content {
    padding: 40px 0;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.2rem;
  }
  
  .section-title h1,
  .section-title h2 {
    font-size: 1.8rem;
  }
  
  .market-card {
    padding: 15px;
  }
  
  .news-main {
    grid-column: span 12;
    margin-bottom: 20px;
  }
  
  .news-secondary {
    grid-column: span 12;
  }
  
  .news-secondary .news-card {
    margin-bottom: 15px;
  }
  
  .footer-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
  }
}

@media (max-width: 768px) {
  .container {
    max-width: 540px;
  }
  
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  
  .top-info-bar .info-item {
    flex: 0 0 50%;
  }
  
  .hero-content {
    padding: 30px 0;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .section-title h1,
  .section-title h2 {
    font-size: 1.5rem;
  }
  
  .table-container {
    overflow-x: auto;
  }
  
  .table th,
  .table td {
    padding: 10px 8px;
    font-size: 0.85rem;
  }
  
  .pagination-numbers {
    display: none;
  }
  
  .pagination-prev,
  .pagination-next {
    margin: 0 5px;
  }
  
  .footer-row {
    grid-template-columns: 1fr;
  }
  
  .footer-bottom {
    flex-direction: column;
    align-items: center;
  }
  
  .footer-bottom-links {
    margin-top: 10px;
  }
  
  /* Exchange page specific */
  .exchange-filters {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .exchange-filters .btn {
    margin: 5px;
  }
  
  /* Portfolio page specific */
  .portfolio-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .portfolio-actions {
    margin-top: 15px;
    width: 100%;
    justify-content: space-between;
  }
  
  .portfolio-summary {
    grid-template-columns: 1fr;
  }
  
  /* Coin detail page specific */
  .coin-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .coin-info {
    margin-top: 15px;
  }
  
  .coin-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .chart-controls {
    flex-wrap: wrap;
  }
  
  .chart-period {
    margin-top: 10px;
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 576px) {
  .container {
    width: 100%;
    padding: 0 15px;
  }
  
  .top-info-bar {
    padding: 5px 0;
  }
  
  .top-info-bar .info-item {
    flex: 0 0 100%;
    padding: 5px 10px;
  }
  
  .navbar-logo {
    max-width: 120px;
  }
  
  .hero-buttons .btn {
    width: 100%;
    margin: 5px 0;
  }
  
  .market-card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .market-card-actions {
    margin-top: 10px;
  }
  
  .news-card {
    flex-direction: column;
  }
  
  .news-img-container {
    width: 100%;
    height: 180px;
  }
  
  .news-content {
    padding: 15px;
  }
  
  .news-title {
    font-size: 1.2rem;
  }
  
  .news-excerpt {
    font-size: 0.9rem;
  }
  
  .news-meta {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .news-date {
    margin-bottom: 5px;
  }
  
  .footer-social {
    justify-content: center;
  }
  
  .footer-title {
    text-align: center;
  }
  
  .footer-links {
    text-align: center;
  }
  
  /* Login/Register pages specific */
  .auth-container {
    width: 100%;
    padding: 20px;
  }
  
  /* Calendar page specific */
  .calendar-filters {
    flex-direction: column;
  }
  
  .calendar-filter-group {
    width: 100%;
    margin-bottom: 10px;
  }
  
  /* Market data page specific */
  .market-data-cards {
    grid-template-columns: 1fr;
  }
  
  /* Converter page specific */
  .converter-form {
    flex-direction: column;
  }
  
  .converter-input,
  .converter-output {
    width: 100%;
  }
  
  .converter-swap {
    margin: 15px 0;
    transform: rotate(90deg);
  }
}

/* Touch-friendly improvements for mobile */
@media (hover: none) {
  .btn:hover,
  .nav-link:hover,
  .dropdown-item:hover,
  .social-link:hover,
  .footer-link:hover {
    transform: none;
  }
  
  .btn,
  .nav-link,
  .dropdown-item,
  .social-link,
  .footer-link,
  .market-card,
  .news-card,
  .pagination-number,
  .btn-favorite,
  .theme-toggle,
  .language-button {
    cursor: default;
    -webkit-tap-highlight-color: transparent;
  }
  
  .btn:active,
  .nav-link:active,
  .dropdown-item:active,
  .social-link:active,
  .footer-link:active,
  .market-card:active,
  .news-card:active,
  .pagination-number:active,
  .btn-favorite:active,
  .theme-toggle:active,
  .language-button:active {
    transform: scale(0.98);
  }
  
  /* Increase touch target sizes */
  .navbar-toggle,
  .theme-toggle,
  .language-button,
  .btn-favorite,
  .pagination-number,
  .pagination-prev,
  .pagination-next {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .dropdown-toggle,
  .nav-link {
    padding: 12px 15px;
  }
  
  .dropdown-item {
    padding: 12px 15px;
  }
  
  /* Improve form elements for touch */
  input,
  select,
  textarea,
  button {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
  
  /* Add scroll momentum on iOS */
  .navbar-menu,
  .dropdown-menu,
  .table-container {
    -webkit-overflow-scrolling: touch;
  }
}

/* Dark mode specific mobile adjustments */
@media (max-width: 768px) {
  body.dark-mode .navbar-menu {
    background-color: var(--dark-bg-color);
    border-right: 1px solid var(--dark-border-color);
  }
  
  body.dark-mode .dropdown-menu {
    background-color: var(--dark-bg-color);
    border: 1px solid var(--dark-border-color);
  }
}

/* Print styles */
@media print {
  .navbar,
  .top-info-bar,
  .footer,
  .btn-favorite,
  .theme-toggle,
  .language-selector,
  .pagination {
    display: none !important;
  }
  
  body {
    background-color: white;
    color: black;
  }
  
  .container {
    max-width: 100%;
    width: 100%;
  }
  
  .market-card,
  .news-card,
  .table {
    box-shadow: none;
    border: 1px solid #ddd;
  }
  
  .table th,
  .table td {
    border-color: #ddd;
  }
  
  a {
    text-decoration: none;
    color: black;
  }
  
  .chart {
    max-width: 500px;
    margin: 0 auto;
  }
}
