/* ============================================
   RESPONSIVE CSS - All Pages
   Breakpoints:
   - Large: > 1200px (Desktop)
   - Medium: 768px - 1200px (Tablet)
   - Small: 480px - 768px (Mobile)
   - Extra Small: < 480px (Small Mobile)
   ============================================ */

/* ============================================
   COMMON RESPONSIVE STYLES
   ============================================ */

/* Medium Displays (Tablet) - 768px to 1200px */
@media (max-width: 1200px) {
    /* General page adjustments */
    .page {
        padding: 15px;
    }
    
    .calculator-page,
    .wiki-page {
        padding: 15px;
    }
    
    /* Stats strip adjustments */
    .stats-strip {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    /* Hero section */
    .hero-title {
        font-size: 20px;
    }
    
    .hero-sub {
        font-size: 12px;
    }
    
    /* City planner layout */
    .main-container {
        flex-direction: column;
    }
    
    .canvas-area {
        flex: 0 0 auto;
        min-height: 400px;
    }
    
    .left-panel,
    .right-panel {
        flex: 0 0 auto;
        max-height: 300px;
    }
    
    /* Calculator pages */
    .combat-sides-wrapper {
        flex-direction: column;
    }
    
    .combat-side {
        min-width: 100%;
    }
    
    .troop-planner-container {
        flex-direction: column;
    }
    
    .troop-planner-left {
        grid-template-columns: 1fr;
    }
    
    /* Wiki pages */
    .units-container {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
}

/* Small Displays (Mobile) - 480px to 768px */
@media (max-width: 768px) {
    /* General page adjustments */
    .page {
        margin: 10px auto;
        padding: 10px;
    }
    
    .calculator-page,
    .wiki-page {
        padding: 10px;
    }
    
    /* Stats strip */
    .stats-strip {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .stat {
        padding: 6px 8px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .stat-value {
        font-size: 12px;
    }
    
    /* Hero section */
    .hero {
        padding: 15px 0 5px 0;
    }
    
    .hero-title {
        font-size: 18px;
    }
    
    .hero-sub {
        font-size: 12px;
    }
    
    /* Calculator headers */
    .calculator-header h1,
    .wiki-header h1 {
        font-size: 24px;
    }
    
    /* City planner */
    .city-planner {
        min-height: 500px;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 8px;
    }
    
    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: center;
    }
    
    .toolbar-left {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .toolbar button {
        flex: 1 1 auto;
        min-width: 80px;
        font-size: 12px;
        padding: 6px 8px;
    }
    
    .main-container {
        flex-direction: column;
    }
    
    .canvas-area {
        flex: 0 0 auto;
        min-height: 300px;
        padding: 5px;
    }
    
    .left-panel,
    .right-panel {
        flex: 0 0 auto;
        max-height: 250px;
        padding: 8px;
    }
    
    .status-bar {
        min-height: 150px;
        padding: 8px;
    }
    
    /* Calculator pages */
    .combat-calculator-container {
        padding: 10px;
        gap: 15px;
    }
    
    .combat-side {
        padding: 10px;
    }
    
    .combat-side-header h2 {
        font-size: 20px;
    }
    
    .combat-troops-grid {
        grid-template-columns: 1fr;
    }
    
    .troop-planner-container {
        padding: 10px;
        gap: 15px;
    }
    
    .troop-planner-left {
        grid-template-columns: 1fr;
    }
    
    .troop-planner-right {
        min-width: 100%;
    }
    
    /* Wiki pages */
    .units-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .unit-card-full {
        padding: 12px;
    }
    
    .unit-header-full {
        flex-direction: column;
        text-align: center;
    }
    
    .unit-name-full {
        font-size: 16px;
    }
}

/* Extra Small Displays (Small Mobile) - < 480px */
@media (max-width: 480px) {
    /* General page adjustments */
    .page {
        margin: 5px auto;
        padding: 5px;
    }
    
    .calculator-page,
    .wiki-page {
        padding: 5px;
    }
    
    /* Stats strip */
    .stats-strip {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .stat {
        padding: 5px 6px;
    }
    
    .stat-icon {
        font-size: 12px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .stat-value {
        font-size: 12px;
    }
    
    /* Hero section */
    .hero {
        padding: 12px 0 4px 0;
    }
    
    .hero-title {
        font-size: 16px;
    }
    
    .hero-sub {
        font-size: 12px;
    }
    
    /* Calculator headers */
    .calculator-header h1,
    .wiki-header h1 {
        font-size: 20px;
    }
    
    .calculator-header p,
    .wiki-header p {
        font-size: 12px;
    }
    
    /* City planner */
    .city-planner {
        min-height: 400px;
    }
    
    .toolbar {
        padding: 6px;
        gap: 4px;
    }
    
    .toolbar button {
        font-size: 12px;
        padding: 5px 6px;
        min-width: 70px;
    }
    
    .level-controls {
        flex-direction: column;
        gap: 6px;
        width: 100%;
    }
    
    .level-controls label {
        width: 100%;
        justify-content: space-between;
    }
    
    .canvas-area {
        min-height: 250px;
        padding: 3px;
    }
    
    .left-panel,
    .right-panel {
        max-height: 200px;
        padding: 6px;
    }
    
    .status-bar {
        min-height: 120px;
        padding: 6px;
    }
    
    /* Calculator pages */
    .combat-calculator-container {
        padding: 8px;
        gap: 12px;
    }
    
    .combat-side {
        padding: 8px;
    }
    
    .combat-side-header {
        padding: 8px;
    }
    
    .combat-side-header h2 {
        font-size: 18px;
    }
    
    .combat-troops-section {
        padding: 10px;
    }
    
    .combat-troops-section h3 {
        font-size: 14px;
    }
    
    .troop-planner-container {
        padding: 8px;
        gap: 12px;
    }
    
    .troop-planner-section-header {
        font-size: 12px;
    }
    
    .troop-planner-unit-row {
        padding: 5px;
        flex-wrap: wrap;
    }
    
    .unit-input {
        width: 50px;
        font-size: 12px;
        padding: 4px;
    }
    
    .unit-planner-label {
        font-size: 12px;
    }
    
    .unit-planner-time {
        font-size: 12px;
        min-width: 50px;
    }
    
    /* Wiki pages */
    .units-container {
        gap: 10px;
    }
    
    .unit-card-full {
        padding: 10px;
    }
    
    .unit-icon-img-full {
        width: 40px;
        height: 40px;
    }
    
    .unit-name-full {
        font-size: 14px;
    }
    
    .unit-stat-row-full {
        padding: 4px 0;
        font-size: 12px;
    }
    
    .stat-label-full {
        font-size: 12px;
    }
    
    .stat-value-full {
        font-size: 12px;
    }
}

/* ============================================
   CITY PLANNER SPECIFIC RESPONSIVE STYLES
   ============================================ */

/* Medium - City Planner */
@media (max-width: 1200px) {
    /* Keep tile-info side by side even on medium screens */
    .tile-info-container {
        flex-direction: row;
        gap: 6px;
    }
    
    .optimal-building, .original-tile {
        min-width: 0;
        flex: 1;
    }
}

/* Small - City Planner */
@media (max-width: 768px) {
    /* Keyboard shortcuts */
    .shortcuts-content {
        padding: 8px;
    }
    
    .shortcut-item {
        padding: 6px;
    }
    
    .shortcut-icon {
        width: 24px;
        height: 24px;
    }
    
    .key {
        font-size: 12px;
        padding: 2px 4px;
    }
    
    /* Building list */
    .building-table {
        font-size: 12px;
    }
    
    .building-icon {
        width: 24px;
        height: 24px;
    }
    
    /* Resource panels */
    .resource-panel {
        padding: 8px;
    }
    
    .resource-header h3 {
        font-size: 12px;
    }
    
    .weight-label {
        font-size: 12px;
    }
    
    .weight-input {
        max-width: 50px;
        font-size: 12px;
        padding: 2px 3px;
    }
    
    .weight-value {
        font-size: 12px;
    }
    
    /* Status bar */
    .status-section {
        margin-bottom: 8px;
    }
    
    .status-item {
        padding: 4px 0;
    }
    
    .status-label {
        font-size: 12px;
    }
    
    .status-value {
        font-size: 12px;
    }
    
    .stat-icon {
        width: 16px;
        height: 16px;
    }
}

/* Extra Small - City Planner */
@media (max-width: 480px) {
    /* Keyboard shortcuts */
    .shortcuts-content {
        padding: 6px;
    }
    
    .shortcut-item {
        padding: 4px;
        gap: 4px;
    }
    
    .shortcut-icon {
        width: 20px;
        height: 20px;
    }
    
    .key {
        font-size: 12px;
        padding: 1px 3px;
    }
    
    /* Building list */
    .building-table {
        font-size: 12px;
    }
    
    .building-icon {
        width: 20px;
        height: 20px;
    }
    
    /* Resource panels */
    .resource-panel {
        padding: 6px;
    }
    
    .resource-header h3 {
        font-size: 12px;
    }
    
    .weight-label {
        font-size: 7px;
    }
    
    .weight-input {
        max-width: 45px;
        font-size: 7px;
        padding: 1px 2px;
    }
    
    .weight-value {
        font-size: 7px;
    }
    
    /* Status bar */
    .status-section {
        margin-bottom: 6px;
    }
    
    .status-item {
        padding: 3px 0;
    }
    
    .status-label {
        font-size: 12px;
    }
    
    .status-value {
        font-size: 12px;
    }
    
    .stat-icon {
        width: 14px;
        height: 14px;
    }
}

/* ============================================
   CALCULATOR PAGES SPECIFIC RESPONSIVE STYLES
   ============================================ */

/* Medium - Calculators */
@media (max-width: 1200px) {
    .calculator-page {
        max-width: 100%;
    }
    
    .combat-calculator-container,
    .troop-planner-container {
        flex-direction: column;
    }
}

/* Small - Calculators */
@media (max-width: 768px) {
    .calculator-page {
        padding: 10px !important;
    }
    
    .combat-calculator-container {
        padding: 10px !important;
        gap: 15px !important;
    }
    
    .combat-sides-wrapper {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .combat-side {
        min-width: 100% !important;
        padding: 10px !important;
    }
    
    .combat-side-header h2 {
        font-size: 20px !important;
    }
    
    .combat-troops-grid {
        grid-template-columns: 1fr !important;
    }
    
    .combat-troop-input {
        width: 70px !important;
        min-width: 70px !important;
        font-size: 12px !important;
    }
    
    .combat-bonus-input {
        width: 80px !important;
        font-size: 12px !important;
    }
    
    .combat-bonus-select {
        width: 120px !important;
        font-size: 12px !important;
    }
    
    .combat-result-section {
        padding: 10px !important;
    }
    
    .combat-result-section h3 {
        font-size: 16px !important;
    }
    
    .troop-planner-container {
        flex-direction: column !important;
        padding: 10px !important;
        gap: 15px !important;
    }
    
    .troop-planner-left {
        grid-template-columns: 1fr !important;
        min-width: 100% !important;
    }
    
    .troop-planner-right {
        min-width: 100% !important;
    }
    
    .unit-input {
        width: 70px !important;
        min-width: 70px !important;
        font-size: 12px !important;
    }
    
    .troop-planner-stats {
        padding: 10px !important;
    }
    
    .troop-planner-stats h3 {
        font-size: 16px !important;
    }
}

/* Extra Small - Calculators */
@media (max-width: 480px) {
    .calculator-page {
        padding: 5px !important;
    }
    
    .calculator-header h1 {
        font-size: 20px !important;
    }
    
    .combat-calculator-container {
        padding: 8px !important;
        gap: 12px !important;
    }
    
    .combat-side {
        padding: 8px !important;
    }
    
    .combat-side-header {
        padding: 8px !important;
    }
    
    .combat-side-header h2 {
        font-size: 18px !important;
    }
    
    .combat-troops-section {
        padding: 10px !important;
    }
    
    .combat-troops-section h3 {
        font-size: 14px !important;
    }
    
    .combat-troop-input {
        width: 60px !important;
        min-width: 60px !important;
        font-size: 12px !important;
        padding: 4px !important;
    }
    
    .combat-troop-label {
        font-size: 12px !important;
    }
    
    .combat-bonus-section {
        padding: 10px !important;
    }
    
    .combat-bonus-section h3 {
        font-size: 14px !important;
    }
    
    .combat-bonus-input {
        width: 70px !important;
        font-size: 12px !important;
        padding: 4px !important;
    }
    
    .combat-bonus-select {
        width: 100px !important;
        font-size: 12px !important;
        padding: 4px !important;
    }
    
    .combat-bonus-label {
        font-size: 12px !important;
    }
    
    .combat-result-section {
        padding: 8px !important;
    }
    
    .combat-result-section h3 {
        font-size: 14px !important;
    }
    
    .troop-planner-container {
        padding: 8px !important;
        gap: 12px !important;
    }
    
    .troop-planner-section-header {
        font-size: 12px !important;
    }
    
    .troop-planner-unit-row {
        padding: 5px !important;
        flex-wrap: wrap !important;
    }
    
    .unit-input {
        width: 50px !important;
        min-width: 50px !important;
        font-size: 12px !important;
        padding: 4px !important;
    }
    
    .unit-planner-label {
        font-size: 12px !important;
    }
    
    .unit-planner-time {
        font-size: 12px !important;
        min-width: 50px !important;
    }
    
    .troop-planner-stats {
        padding: 8px !important;
    }
    
    .troop-planner-stats h3 {
        font-size: 14px !important;
    }
}

/* ============================================
   WIKI PAGES SPECIFIC RESPONSIVE STYLES
   ============================================ */

/* Medium - Wiki */
@media (max-width: 1200px) {
    .wiki-page {
        max-width: 100%;
    }
}

/* Small - Wiki */
@media (max-width: 768px) {
    .wiki-page {
        padding: 10px;
    }
    
    .guides-note {
        padding: 12px;
        font-size: 13px;
    }
}

/* Extra Small - Wiki */
@media (max-width: 480px) {
    .wiki-page {
        padding: 5px;
    }
    
    .guides-note {
        padding: 10px;
        font-size: 12px;
    }
    
    .guides-note p {
        margin: 8px 0;
    }
}

/* ============================================
   HEADER AND NAVIGATION RESPONSIVE STYLES
   ============================================ */

/* Medium - Header */
@media (max-width: 1200px) {
    .site-header {
        padding: 10px 15px;
    }
    
    .logo {
        max-height: 40px;
    }
}

/* Small - Header */
@media (max-width: 768px) {
    .site-header {
        padding: 8px 10px;
    }
    
    .logo {
        max-height: 35px;
    }
    
    /* Hamburger menu is already handled in main.css */
}

/* Extra Small - Header */
@media (max-width: 480px) {
    .site-header {
        padding: 6px 8px;
    }
    
    .logo {
        max-height: 30px;
    }
}

/* ============================================
   MODAL RESPONSIVE STYLES
   ============================================ */

/* Medium - Modals */
@media (max-width: 1200px) {
    .modal-content {
        max-width: 90vw;
        padding: 20px;
    }
}

/* Small - Modals */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95vw;
        padding: 15px;
        max-height: 90vh;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
}

/* Extra Small - Modals */
@media (max-width: 480px) {
    .modal-content {
        max-width: 98vw;
        padding: 12px;
        max-height: 95vh;
    }
    
    .modal-header h2 {
        font-size: 16px;
    }
    
    .modal-body {
        font-size: 13px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer button {
        width: 100%;
    }
}

/* ============================================
   FOOTER RESPONSIVE STYLES
   ============================================ */

/* Medium - Footer */
@media (max-width: 1200px) {
    .site-footer {
        padding: 15px;
    }
}

/* Small - Footer */
@media (max-width: 768px) {
    .site-footer {
        padding: 12px;
        font-size: 12px;
    }
    
    .site-footer .footer-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Extra Small - Footer */
@media (max-width: 480px) {
    .site-footer {
        padding: 10px;
        font-size: 12px;
    }
}

.planner-title {
    font-family: Cinzel, Georgia, serif;
    font-size: 22px;
    font-weight: 600;
    color: #e1c190;
    text-align: center;
    margin: 12px 16px 0;
}

.first-visit {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    max-width: 960px;
    margin: 10px auto 0;
    padding: 10px 14px;
    border: 1px solid rgba(199, 168, 107, 0.35);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.28);
    text-transform: none;
}

.first-visit p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.first-visit.is-dismissed {
    display: none;
}

.login-banner {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid rgba(199, 168, 107, 0.45);
    border-radius: 8px;
    background: rgba(199, 168, 107, 0.12);
    font-size: 14px;
}

.login-banner a {
    color: #e1c190;
    margin-left: 8px;
}

.wiki-search-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.wiki-search-row input {
    flex: 1 1 auto;
    min-width: 0;
}

.calculator-index {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

.calculator-index h1 {
    font-family: Cinzel, Georgia, serif;
    color: #e1c190;
    font-size: 28px;
    margin-bottom: 8px;
}

.calculator-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.calculator-cards a {
    display: block;
    padding: 14px;
    border: 1px solid rgba(199, 168, 107, 0.35);
    border-radius: 8px;
    color: #e1c190;
    text-decoration: none;
    background: rgba(0, 0, 0, 0.25);
}

.calculator-cards p {
    color: #e5e3de;
    font-size: 14px;
    margin: 6px 0 0;
}

@media (max-width: 768px) {
    #footer {
        position: static;
        left: auto;
        transform: none;
        width: 100%;
    }

    body {
        padding-bottom: 16px;
    }

    .toolbar,
    .toolbar-left,
    .toolbar-right {
        flex-direction: row;
        flex-wrap: wrap;
        width: auto;
    }

    .toolbar button {
        flex: 0 1 auto;
        width: auto;
        font-size: 12px;
    }

    .wiki-search-row {
        flex-wrap: wrap;
    }

    .wiki-search-row button,
    .wiki-search-row input {
        width: 100%;
        flex: 1 1 100%;
    }

    .first-visit {
        flex-direction: column;
        align-items: stretch;
        margin: 10px 12px 0;
    }
}

