/* Mobile-First Responsive CSS for Business Bus Stop */
:root {
    --primary-color: #5D5CDE;
    --primary-dark: #4B4AB2;
    --bg-light: #ffffff;
    --bg-dark: #181818;
    --text-light: #333333;
    --text-dark: #f0f0f0;
    --gray-100: #f7f7f7;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-500: #6b7280;
    --gray-600: #6b7280;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --red-500: #ef4444;
    --blue-50: #eff6ff;
    --blue-500: #3b82f6;
    --blue-700: #1d4ed8;
    --blue-900: #1e3a8a;
    --green-500: #22c55e;
    --facebook-blue: #4267B2;
    --facebook-blue-dark: #365899;
    --facebook-text-dark: #050505;
    --facebook-text-gray: #65676b;
    --facebook-bg-light: #f0f2f5;
    --facebook-border: #f0f2f5;
}

/* Base Mobile Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--text-light);
    transition: background-color 0.3s, color 0.3s;
    font-size: 16px;
    line-height: 1.5;
    overflow-x: hidden;
}

body.dark {
    background-color: var(--bg-dark);
    color: var(--text-dark);
}

/* Dark Mode Toggle - Mobile First */
.dark-mode-toggle {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.dark-mode-toggle:hover,
.dark-mode-toggle:active {
    background-color: var(--primary-dark);
    transform: scale(1.05);
}

/* Container - Mobile First */
.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 15px;
    padding-top: 80px; /* Account for dark mode toggle */
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 25px;
    padding: 0 10px;
}

.title {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    word-wrap: break-word;
    line-height: 1.2;
}

.title i {
    margin-right: 8px;
    font-size: 24px;
}

/* Grid Layout - Mobile First (Single Column) */
.grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* Cards */
.card {
    background-color: var(--bg-light);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--gray-200);
    width: 100%;
    transition: all 0.3s ease;
}

body.dark .card {
    background-color: var(--gray-800);
    border-color: var(--gray-700);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    line-height: 1.3;
}

body.dark .card-title {
    color: var(--text-dark);
}

.card-title i {
    margin-right: 10px;
    font-size: 18px;
    color: var(--primary-color);
}

/* Form Styles - Mobile Optimized */
.form-group {
    margin-bottom: 20px;
}

.label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-light);
    display: flex;
    align-items: center;
}

body.dark .label {
    color: var(--text-dark);
}

.label i {
    margin-right: 8px;
    font-size: 14px;
    color: var(--primary-color);
    width: 16px;
}

.input, .select, .textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--gray-300);
    border-radius: 10px;
    font-size: 16px;
    background-color: var(--bg-light);
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

body.dark .input,
body.dark .select,
body.dark .textarea {
    background-color: var(--gray-700);
    border-color: var(--gray-600);
    color: var(--text-dark);
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(93, 92, 222, 0.1);
    transform: translateY(-1px);
}

.textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

/* Custom File Input - Mobile Friendly */
.custom-file-input {
    width: 100%;
    padding: 16px;
    border: 2px dashed var(--gray-300);
    border-radius: 10px;
    background-color: var(--bg-light);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-file-input:hover {
    border-color: var(--primary-color);
    background-color: rgba(93, 92, 222, 0.02);
}

.custom-file-input::file-selector-button {
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    margin-right: 16px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.custom-file-input::file-selector-button:hover {
    background-color: var(--primary-dark);
}

body.dark .custom-file-input {
    background-color: var(--gray-700);
    border-color: var(--gray-600);
    color: var(--text-dark);
}

body.dark .custom-file-input::file-selector-button {
    background-color: var(--primary-dark);
    color: white;
}

/* Buttons - Mobile Optimized */
.btn {
    cursor: pointer;
    border: none;
    border-radius: 10px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    display: block;
    width: 100%;
    min-height: 52px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover,
.btn-primary:active {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 92, 222, 0.3);
}

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--text-light);
}

body.dark .btn-secondary {
    background-color: var(--gray-700);
    color: var(--text-dark);
}

.btn-secondary:hover,
.btn-secondary:active {
    background-color: var(--gray-300);
    transform: translateY(-1px);
}

body.dark .btn-secondary:hover,
body.dark .btn-secondary:active {
    background-color: var(--gray-600);
}

.btn-danger {
    background-color: var(--red-500);
    color: white;
}

.btn-danger:hover,
.btn-danger:active {
    background-color: #dc2626;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Ad Preview Section - Mobile Optimized */
#adPreview {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    padding: 20px;
    background-color: var(--facebook-bg-light);
    border-radius: 12px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

body.dark #adPreview {
    background-color: var(--gray-800);
}

.ad-preview-placeholder {
    text-align: center;
    color: var(--gray-600);
    font-size: 16px;
    padding: 20px;
}

body.dark .ad-preview-placeholder {
    color: var(--gray-400);
}

/* Ad Card - Mobile First */
.ad-card {
    background-color: var(--bg-light);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    font-family: inherit;
    color: var(--text-light);
    transition: all 0.5s ease;
}

body.dark .ad-card {
    background-color: var(--gray-700);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: var(--text-dark);
}

.fade-in-out {
    animation: fadeInOut 0.5s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Ad Header */
.ad-header {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--facebook-border);
}

body.dark .ad-header {
    border-color: var(--gray-600);
}

.profile-pic-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--facebook-blue);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

.ad-info {
    flex-grow: 1;
    min-width: 0;
}

.ad-advertiser {
    font-weight: 600;
    font-size: 16px;
    color: var(--facebook-text-dark);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark .ad-advertiser {
    color: var(--text-dark);
}

.ad-type {
    font-size: 14px;
    color: var(--facebook-text-gray);
}

body.dark .ad-type {
    color: var(--gray-300);
}

.ad-options {
    font-size: 20px;
    color: var(--facebook-text-gray);
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
}

body.dark .ad-options {
    color: var(--gray-300);
}

/* Ad Body */
.ad-body {
    padding: 16px;
}

.ad-description {
    font-size: 16px;
    line-height: 1.4;
    margin-bottom: 12px;
    color: var(--facebook-text-dark);
    word-wrap: break-word;
}

body.dark .ad-description {
    color: var(--text-dark);
}

.ad-image-container {
    width: 100%;
    max-height: 300px;
    overflow: hidden;
    border-radius: 8px;
    margin-top: 12px;
    background-color: #e9ebee;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 300px;
}

/* Ad Footer */
.ad-footer {
    padding: 16px;
    border-top: 1px solid var(--facebook-border);
}

body.dark .ad-footer {
    border-color: var(--gray-600);
}

.ad-title {
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--facebook-text-dark);
    word-wrap: break-word;
}

body.dark .ad-title {
    color: var(--text-dark);
}

.ad-cta-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ad-contact {
    font-size: 14px;
    color: var(--facebook-text-gray);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark .ad-contact {
    color: var(--gray-300);
}

.ad-cta-button {
    background-color: var(--facebook-blue);
    color: white;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
    font-size: 16px;
    min-height: 48px;
}

.ad-cta-button:hover,
.ad-cta-button:active {
    background-color: var(--facebook-blue-dark);
}

/* Queue Management - Mobile */
.queue-container {
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.queue-item {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    background-color: var(--gray-100);
    transition: all 0.3s ease;
}

body.dark .queue-item {
    background-color: var(--gray-700);
}

.queue-item.active {
    background-color: rgba(93, 92, 222, 0.1);
    border-left: 4px solid var(--primary-color);
    transform: translateX(4px);
}

.queue-title {
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queue-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.queue-button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    color: white;
    border: none;
    cursor: pointer;
    flex: 1;
    min-width: 80px;
    min-height: 36px;
    font-weight: 500;
}

/* Group Management - Mobile */
.group-list {
    margin-top: 15px;
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.group-item {
    display: flex;
    flex-direction: column;
    padding: 16px;
    margin-bottom: 10px;
    border-radius: 8px;
    background-color: var(--gray-100);
    gap: 10px;
}

body.dark .group-item {
    background-color: var(--gray-700);
}

.group-info {
    flex: 1;
}

.group-name {
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 4px;
}

.group-id {
    font-size: 14px;
    color: var(--gray-600);
}

body.dark .group-id {
    color: var(--gray-400);
}

.group-actions {
    display: flex;
    gap: 8px;
    width: 100%;
}

.group-actions button {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 6px;
    min-height: 40px;
}

/* Modal - Mobile Optimized */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background-color: var(--bg-light);
    margin: 10% auto;
    padding: 24px;
    border: none;
    width: 100%;
    max-width: 90%;
    border-radius: 16px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.dark .modal-content {
    background-color: var(--gray-800);
    color: var(--text-dark);
}

.close-button {
    color: var(--gray-600);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 8px;
    margin: -8px;
}

body.dark .close-button {
    color: var(--gray-400);
}

.platform-group-fields {
    display: none;
}

/* Navigation Controls - Mobile */
.flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 8px;
}

.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.ml-auto { margin-left: auto; }

.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-gray { color: var(--gray-600); }

body.dark .text-gray {
    color: var(--gray-400);
}

/* Section Tips - Mobile */
.section-tip {
    background-color: var(--blue-50);
    color: var(--blue-700);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}

body.dark .section-tip {
    background-color: rgba(30, 58, 138, 0.2);
    color: #93c5fd;
}

.tip-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.tip-title i {
    margin-right: 8px;
    color: var(--blue-700);
}

body.dark .tip-title i {
    color: #93c5fd;
}

.tip-list {
    padding-left: 0;
    margin: 0;
    list-style: none;
}

.tip-list li {
    margin-bottom: 8px;
    font-size: 15px;
    padding-left: 24px;
    position: relative;
}

.tip-list li i {
    position: absolute;
    left: 0;
    top: 2px;
    color: var(--green-500);
}

/* Notifications - Mobile */
.notification {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.notification.success {
    background-color: var(--green-500);
}

.notification.error {
    background-color: var(--red-500);
}

.notification.show {
    opacity: 1;
    transform: translateY(-10px);
}

/* Button Groups - Mobile */
.form-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

/* Utility Classes */
.w-full { width: 100%; }
.text-center { text-align: center; }
.font-bold { font-weight: bold; }
.hidden { display: none; }

/* Tablet Styles */
@media (min-width: 768px) {
    .container {
        max-width: 768px;
        margin: 0 auto;
        padding: 25px;
        padding-top: 90px;
    }
    
    .title {
        font-size: 30px;
    }
    
    .card {
        padding: 24px;
    }
    
    .ad-card {
        max-width: 450px;
        margin: 0 auto;
    }
    
    #adPreview {
        min-height: 350px;
        padding: 25px;
    }
    
    .ad-image-container {
        max-height: 350px;
    }
    
    .ad-cta-section {
        flex-direction: row;
        align-items: center;
    }
    
    .ad-cta-button {
        width: auto;
        flex-shrink: 0;
        min-width: 140px;
    }
    
    .ad-contact {
        flex-grow: 1;
    }
    
    .group-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .group-actions {
        width: auto;
        flex-shrink: 0;
    }
    
    .group-actions button {
        flex: none;
        min-width: 80px;
    }
    
    .form-buttons {
        flex-direction: row;
        justify-content: flex-end;
    }
    
    .form-buttons .btn {
        width: auto;
        min-width: 120px;
    }
    
    .notification {
        bottom: 30px;
        right: 30px;
        left: auto;
        max-width: 400px;
    }
    
    .queue-container {
        max-height: 300px;
    }
    
    .group-list {
        max-height: 300px;
    }
    
    .modal-content {
        max-width: 500px;
        margin: 5% auto;
    }
}

/* Desktop Styles */
@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
        padding: 30px;
    }
    
    .grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        align-items: start;
    }
    
    .title {
        font-size: 32px;
    }
    
    .card {
        margin-bottom: 0;
    }
    
    .ad-card {
        max-width: 500px;
    }
    
    #adPreview {
        min-height: 400px;
    }
    
    .dark-mode-toggle {
        top: 25px;
        right: 25px;
        width: 45px;
        height: 45px;
    }
    
    .queue-container {
        max-height: 350px;
    }
    
    .group-list {
        max-height: 350px;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    .grid {
        gap: 35px;
    }
    
    .ad-card {
        max-width: 550px;
    }
}

/* Extra Small Mobile Adjustments */
@media (max-width: 375px) {
    .container {
        padding: 12px;
    }
    
    .card {
        padding: 16px;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .title {
        font-size: 22px;
    }
    
    .dark-mode-toggle {
        width: 45px;
        height: 45px;
        top: 12px;
        right: 12px;
    }
    
    .notification {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }
}

/* High DPI / Retina Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .ad-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for better keyboard navigation */
.btn:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Improved touch targets for mobile */
@media (pointer: coarse) {
    .btn,
    .queue-button,
    .group-actions button {
        min-height: 44px;
    }
    
    .dark-mode-toggle {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Print styles */
@media print {
    .dark-mode-toggle,
    .notification,
    .modal {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}