* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #0f0f0f;
    --bg-tertiary: #2a2a2a;
    --bg-card: #242424;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #707070;
    --accent: #c0c0c0;
    --accent-hover: #a0a0a0;
    --border: #333333;
    --shadow: rgba(0, 0, 0, 0.5);
    --error: #ff3b30;
    --success: #34c759;
    --gradient: linear-gradient(135deg, #c0c0c0 0%, #808080 100%);
    --mac-red: #ff5f57;
    --mac-yellow: #ffbd2e;
    --mac-green: #28ca42;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Custom Scrollbar - Black & White style */
::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 0;
}

::-webkit-scrollbar-thumb {
    background: #808080;
    border-radius: 8px;
    border: 2px solid #1a1a1a;
    min-height: 40px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

::-webkit-scrollbar-button {
    display: block;
    height: 16px;
    width: 16px;
    background: #1a1a1a;
    border: none;
}

::-webkit-scrollbar-button:single-button:vertical:decrement {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath fill='%23ffffff' d='M4 2l-2 2h4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 8px 8px;
}

::-webkit-scrollbar-button:single-button:vertical:increment {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath fill='%23c0c0c0' d='M4 6l2-2h-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 8px 8px;
}

::-webkit-scrollbar-corner {
    background: #1a1a1a;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 1rem;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 1rem;
    z-index: 100;
    box-shadow: 0 2px 10px var(--shadow);
    border-radius: 20px;
    margin: 0 1rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s;
    min-width: 45px;
    text-align: center;
}

.lang-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #0f0f0f;
    transform: scale(1.05);
}

.nav-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--bg-tertiary);
    color: var(--accent);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 1.5rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* Welcome Page */
.welcome-hero {
    text-align: center;
    padding: 4rem 2rem;
    margin-bottom: 4rem;
}

.welcome-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.btn-hero {
    background: var(--gradient);
    color: #0f0f0f;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(192, 192, 192, 0.15);
}

.btn-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(192, 192, 192, 0.2);
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem;
    transition: all 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 8px 25px rgba(192, 192, 192, 0.1);
}

.feature-icon {
    width: 64px;
    height: 64px;
    background: var(--gradient);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: #0f0f0f;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Tutorial Section */
.tutorial-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 3rem 2rem;
    margin-bottom: 4rem;
}

.tutorial-section h2 {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.tutorial-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.tutorial-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.example-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
}

.example-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.example-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.example-card h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-align: center;
}

.example-card ul {
    list-style: none;
    padding: 0;
}

.example-card li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    padding-left: 1.5rem;
    position: relative;
}

.example-card li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

.example-card li:last-child {
    border-bottom: none;
}

/* How It Works */
.how-it-works {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
}

.how-it-works h2 {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.step {
    text-align: center;
}

.step-number {
    width: 60px;
    height: 60px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f0f0f;
    margin: 0 auto 1.5rem;
    box-shadow: 0 4px 15px rgba(192, 192, 192, 0.15);
}

.step h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.step p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Upload Section */
.upload-section {
    max-width: 800px;
    margin: 0 auto;
}

.upload-area {
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.upload-area:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.upload-area.dragover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
    transform: scale(1.02);
}

/* Mac Window Controls */
.mac-window-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.mac-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    transition: all 0.2s;
}

.mac-dot-red {
    background: var(--mac-red);
    box-shadow: 0 0 0 1px rgba(255, 95, 87, 0.3);
}

.mac-dot-yellow {
    background: var(--mac-yellow);
    box-shadow: 0 0 0 1px rgba(255, 189, 46, 0.3);
}

.mac-dot-green {
    background: var(--mac-green);
    box-shadow: 0 0 0 1px rgba(40, 202, 66, 0.3);
}

.mac-dot:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.upload-icon {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.upload-area h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.btn-primary {
    background: var(--gradient);
    color: #0f0f0f;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

/* Preview Section */
.preview-section {
    margin-top: 2rem;
}

.image-preview {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px var(--shadow);
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 500px;
    object-fit: contain;
}

.btn-remove {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: scale(1.1);
}

.btn-analyze {
    width: 100%;
    background: var(--gradient);
    color: #0f0f0f;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(192, 192, 192, 0.15);
}

.btn-analyze:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(192, 192, 192, 0.2);
}

.btn-analyze:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(192, 192, 192, 0.3);
    border-top-color: #c0c0c0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Slider Loading Animation */
.slider-loader {
    width: 40px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.slider-bar {
    width: 4px;
    height: 24px;
    background: #c0c0c0;
    border-radius: 2px;
    animation: sliderMove 1.2s ease-in-out infinite;
    opacity: 0.8;
}

.slider-bar:nth-child(1) {
    animation-delay: 0s;
}

.slider-bar:nth-child(2) {
    animation-delay: 0.15s;
}

.slider-bar:nth-child(3) {
    animation-delay: 0.3s;
}

.slider-bar:nth-child(4) {
    animation-delay: 0.45s;
}

.slider-bar:nth-child(5) {
    animation-delay: 0.6s;
}

@keyframes sliderMove {
    0%, 100% {
        transform: scaleY(0.3);
        opacity: 0.4;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Result Section */
.result-section {
    margin-top: 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 15px var(--shadow);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.result-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.result-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(192, 192, 192, 0.15);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.result-flag {
    display: inline-block;
    font-size: 1.2rem;
    margin-right: 0.25rem;
}

.result-content {
    color: var(--text-primary);
    line-height: 1.8;
    white-space: pre-wrap;
    margin-bottom: 1.5rem;
}

.result-map-container {
    margin: 1.5rem 0;
}

.result-map-container #resultMap {
    width: 100%;
    background: var(--bg-tertiary);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.result-map-container .leaflet-container {
    background: var(--bg-tertiary);
    border-radius: 16px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.result-map-container .leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.result-map-container .leaflet-popup-tip {
    background: white;
}

.custom-marker {
    background: transparent !important;
    border: none !important;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 1.5rem;
    color: var(--error);
}

.error-message svg {
    margin-bottom: 1rem;
}

.error-message ul {
    margin-top: 1rem;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.error-message li {
    margin: 0.5rem 0;
}

.result-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
    color: var(--accent);
}

/* History Section */
.history-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.history-list {
    display: grid;
    gap: 1rem;
}

.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.1);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.history-item-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.history-item-content {
    color: var(--text-primary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.empty-subtitle {
    font-size: 0.95rem;
    opacity: 0.7;
}

/* Target Audience Section */
.target-audience-section {
    margin-top: 4rem;
    padding: 3rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.target-audience-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.target-audience-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.target-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s;
}

.target-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 8px 25px rgba(192, 192, 192, 0.1);
}

.target-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.target-icon img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.target-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.target-card-desc {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.95rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-section,
.preview-section {
    animation: fadeIn 0.3s ease-out;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header {
        margin: 0 0.5rem;
        border-radius: 16px;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav {
        width: 100%;
        justify-content: space-around;
    }

    .main-content {
        padding: 1.5rem 1rem;
    }

    .welcome-hero {
        padding: 2rem 1rem;
    }

    .welcome-title {
        font-size: 2rem;
    }

    .welcome-subtitle {
        font-size: 1rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .steps {
        grid-template-columns: 1fr;
    }

    .upload-area {
        padding: 2rem 1.5rem;
    }

    .upload-area h2 {
        font-size: 1.25rem;
    }

    .result-card {
        padding: 1.5rem;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .result-actions {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
    }

    .image-preview img {
        max-height: 300px;
    }

    .how-it-works {
        padding: 2rem 1.5rem;
    }

    .how-it-works h2 {
        font-size: 1.5rem;
    }

    .target-audience-section {
        padding: 2rem 1.5rem;
        margin-top: 3rem;
    }

    .target-audience-title {
        font-size: 1.75rem;
        margin-bottom: 2rem;
    }

    .target-audience-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header {
        margin: 0 0.5rem;
        border-radius: 16px;
        padding: 0.75rem 1rem;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }

    .welcome-title {
        font-size: 1.75rem;
    }

    .upload-area {
        padding: 1.5rem 1rem;
    }

    .result-card {
        padding: 1rem;
    }

    .feature-card {
        padding: 1.5rem;
    }

    .target-audience-section {
        padding: 1.5rem 1rem;
    }

    .target-audience-title {
        font-size: 1.5rem;
    }

    .target-card {
        padding: 1.5rem;
    }
}
