* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --bg: #f8fafc;
    --bg-gradient: linear-gradient(135deg, #e0e7ff 0%, #f8fafc 50%, #fef3c7 100%);
    --card-bg: #ffffff;
    --text: #1e1b4b;
    --text-light: #64748b;
    --border: #e0e7ff;
    --radius: 16px;
    --shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
    --shadow-hover: 0 8px 30px rgba(99, 102, 241, 0.25);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    background-image: var(--bg-gradient);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(99, 102, 241, 0.08);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 28px;
}

.nav-list a {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 600;
    font-size: 15px;
    transition: color 0.2s;
}

.nav-list a:hover,
.nav-list a.active {
    color: var(--primary);
}

.lang-selector {
    background: #fff;
    color: var(--text);
    border: 2px solid var(--primary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    min-width: 100px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
    transition: all 0.2s;
}

.lang-selector:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.lang-selector:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.lang-selector option {
    background: #fff;
    color: var(--text);
    padding: 8px;
}

/* Hero */
.hero {
    text-align: center;
    padding: 60px 24px;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, transparent 100%);
}

.hero-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.hero-content {
    flex: 1;
    min-width: 260px;
    max-width: 420px;
}

.hero-content h2 {
    font-size: 38px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-dark), var(--accent-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.hero-content p {
    color: var(--text-light);
    font-size: 18px;
}

.hero-tool-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
    min-width: 150px;
    text-align: center;
    box-shadow: var(--shadow);
}

.hero-tool-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
    transform: translateY(-6px);
}

.hero-tool-icon {
    font-size: 42px;
    margin-bottom: 12px;
    display: block;
}

.hero-tool-card h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.hero-tool-card p {
    font-size: 13px;
    color: var(--text-light);
}

.hero-local-time {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 10px;
    font-family: 'SF Mono', 'Courier New', monospace;
}

/* Main Content with Sidebar Ads */
.main-wrapper {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    gap: 24px;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.sidebar-ad {
    flex-shrink: 0;
    width: 160px;
}

.sidebar-ad .ad-label {
    font-size: 11px;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 8px;
}

.ad-placeholder.sidebar {
    background: var(--card-bg);
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    color: var(--text-light);
    font-size: 11px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

@media (max-width: 900px) {
    .main-wrapper {
        flex-direction: column;
    }

    .sidebar-ad {
        width: 100%;
        order: 1;
    }

    .left-ad { order: 0; }
    .right-ad { order: 2; }
    .main-content { order: 1; }
}

/* Sections */
.tools-section {
    padding: 48px 0;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(135deg, var(--primary), var(--accent)) 1;
    display: inline-block;
    color: var(--text);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.tool-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s;
}

.tool-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-icon {
    font-size: 38px;
    margin-bottom: 14px;
    display: block;
}

.tool-card h4 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.tool-card p {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
}

/* Ad Containers */
.ad-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 24px 0;
}

.ad-label {
    font-size: 11px;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ad-placeholder {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(245, 158, 11, 0.05));
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Page Content */
.page-content {
    padding: 48px 24px;
    max-width: 720px;
}

.page-content h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
}

.page-content h3 {
    font-size: 22px;
    margin-top: 36px;
    margin-bottom: 14px;
}

.page-content p {
    margin-bottom: 16px;
}

.page-content ul {
    margin-bottom: 16px;
    padding-left: 24px;
}

.page-content li {
    margin-bottom: 8px;
}

.page-content a {
    color: var(--primary);
    text-decoration: none;
}

.page-content a:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: 14px;
    background: rgba(255, 255, 255, 0.5);
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.footer-links {
    margin-top: 14px;
}

.footer-links a {
    margin: 0 10px;
}

/* Tool Pages */
.tool-page {
    padding: 40px 24px;
}

.converter, .calculator {
    max-width: 520px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 36px;
    border-radius: 24px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow);
}

.converter h2, .calculator h2 {
    margin-bottom: 28px;
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s;
    background: var(--card-bg);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.result {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 14px;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-top: 22px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.result-box {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(245, 158, 11, 0.08));
    border-radius: 14px;
    padding: 22px;
    margin-top: 22px;
    border: 1px solid var(--border);
}

.result-box .result-label {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.result-box .result-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--primary);
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.result-row:last-child {
    border-bottom: none;
}

/* Back to Home Button */
.back-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 14px 28px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 28px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.back-home-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.45);
}

.back-icon {
    font-size: 18px;
}

/* Location Button */
.location-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.location-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.location-status {
    margin-top: 16px;
    padding: 14px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
}

.location-status.loading {
    background: #fef3c7;
    color: #92400e;
}

.location-status.success {
    background: #d1fae5;
    color: #065f46;
}

.location-status.error {
    background: #fee2e2;
    color: #991b1b;
}

/* World Times Grid */
.world-times-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.world-time-item {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    transition: all 0.2s;
}

.world-time-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.world-time-item .city-name {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text);
}

.world-time-item .city-time {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.world-time-item .city-date {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.world-time-item .city-offset {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

/* Local Time Display */
.local-time-display {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    border-radius: 20px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.35);
}

.local-time-label {
    font-size: 15px;
    opacity: 0.95;
    margin-bottom: 10px;
    font-weight: 600;
}

.local-time-value {
    font-size: 52px;
    font-weight: 800;
    font-family: 'SF Mono', 'Courier New', monospace;
    letter-spacing: 3px;
}

.local-time-date {
    font-size: 16px;
    opacity: 0.9;
    margin-top: 10px;
}

@media (max-width: 600px) {
    .hero-content h2 {
        font-size: 28px;
    }

    .nav-list {
        gap: 14px;
    }

    .ad-placeholder {
        padding: 24px;
        min-height: 70px;
    }

    .hero-wrapper {
        gap: 20px;
    }
}