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

:root {
    --primary: #6D94C5;
    --primary-light: #CBDCEB;
    --cream: #E8DFCA;
    --cream-light: #F5EFE6;
    --text: #2d3748;
    --text-light: #718096;
    --white: #ffffff;
    --shadow: 0 4px 20px rgba(109, 148, 197, 0.15);
    --shadow-lg: 0 10px 40px rgba(109, 148, 197, 0.2);
    --radius: 20px;
    --radius-sm: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--cream-light) 0%, var(--primary-light) 100%);
    min-height: 100vh;
    color: var(--text);
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* Get Location Button */
.get-location-btn {
    width: 100%;
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, #5a7fb0 100%);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, box-shadow 0.2s;
}

.get-location-btn:hover {
    box-shadow: 0 15px 50px rgba(109, 148, 197, 0.3);
}

.get-location-btn:active {
    transform: translateY(0);
}

.get-location-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.get-location-btn svg {
    width: 24px;
    height: 24px;
}

/* Bento Grid - Asymmetric Layout */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto;
    gap: 12px;
}

.bento-item {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.bento-item:hover {
    box-shadow: var(--shadow-lg);
}

/* Grid positioning for asymmetric layout */
.bento-digipin {
    grid-column: span 2;
    grid-row: span 1;
}

.bento-qr {
    grid-column: span 1;
    grid-row: span 1;
    padding: 0;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.bento-coords {
    grid-column: span 1;
    grid-row: span 1;
    padding: 0;
    overflow: hidden;
    min-height: 140px;
}

.bento-map {
    grid-column: span 2;
    grid-row: span 2;
    padding: 0;
    overflow: hidden;
    min-height: 280px;
}

.bento-actions {
    grid-column: span 2;
    grid-row: span 2;
}

.bento-decode {
    grid-column: span 2;
    grid-row: span 1;
}

.bento-copy {
    grid-column: span 1;
    grid-row: span 1;
}

.bento-share {
    grid-column: span 1;
    grid-row: span 1;
    padding: 0;
    overflow: hidden;
}

.bento-logo {
    grid-column: span 1;
    grid-row: span 1;
}

.bento-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.bento-label svg {
    width: 12px;
    height: 12px;
}

.bento-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* DIGIPIN Display */
.digipin-display {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 2px;
    text-align: center;
    padding: 16px;
    background: linear-gradient(135deg, var(--cream-light) 0%, var(--cream) 100%);
    border-radius: var(--radius-sm);
    word-break: break-all;
}

.digipin-display.placeholder {
    color: var(--text-light);
    font-size: 14px;
    letter-spacing: 0;
}

/* Coordinates */
.coords-display {
    text-align: center;
    padding: 12px;
    background: linear-gradient(135deg, var(--cream-light) 0%, var(--cream) 100%);
    border-radius: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.coords-display .lat-lng {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    font-family: 'SF Mono', 'Monaco', monospace;
    word-break: break-all;
}

/* QR Code */
.qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    background: #ffffff;
    border-radius: 0;
    padding: 8px;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.qr-container:hover {
    transform: scale(1.02);
}

.qr-container:active {
    transform: scale(0.98);
}

.qr-container canvas,
.qr-container img,
.qr-container svg {
    border-radius: 0;
    max-width: calc(100% - 16px);
    max-height: calc(100% - 16px);
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

.qr-placeholder {
    color: var(--text-light);
    font-size: 11px;
    text-align: center;
}

/* Map */
.map-container {
    width: 100%;
    height: 100%;
    flex: 1;
    border-radius: 0;
    overflow: hidden;
    background: linear-gradient(135deg, var(--cream-light) 0%, var(--cream) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-container #map {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.map-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.map-placeholder {
    color: var(--text-light);
    font-size: 12px;
    text-align: center;
}

/* Leaflet marker customization */
.leaflet-marker-icon {
    filter: hue-rotate(200deg) saturate(1.2);
}

/* Action Buttons - Vertical Stack */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--cream-light);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
    flex: 1;
}

.action-btn:hover:not(:disabled) {
    background: var(--primary-light);
    color: var(--primary);
    transform: scale(1.02);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

.action-btn span {
    font-size: 13px;
    font-weight: 600;
}

/* Single Action Button */
.single-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: var(--cream-light);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
    flex: 1;
    width: 100%;
}

.single-action-btn:hover:not(:disabled) {
    background: var(--primary-light);
    color: var(--primary);
    transform: scale(1.02);
}

.single-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.single-action-btn svg {
    width: 28px;
    height: 28px;
}

.single-action-btn span {
    font-size: 12px;
    font-weight: 600;
}

/* Links Grid (2x2) */
.links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 8px;
}

.link-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: var(--cream-light);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
    text-decoration: none;
    padding: 8px;
}

.link-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: scale(1.03);
}

.link-btn svg {
    width: 18px;
    height: 18px;
}

.link-btn span {
    font-size: 8px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

/* Logo Box */
.bento-logo {
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cream-light) 0%, var(--cream) 100%);
}

.logo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
}

/* Decode Section */
.decode-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.decode-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'SF Mono', 'Monaco', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: border-color 0.2s;
    text-align: center;
}

.decode-input:focus {
    outline: none;
    border-color: var(--primary);
}

.decode-input::placeholder {
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-light);
    font-size: 11px;
}

.coords-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: 'SF Mono', 'Monaco', monospace;
    transition: border-color 0.2s;
    text-align: center;
}

.coords-input:focus {
    outline: none;
    border-color: var(--primary);
}

.coords-input::placeholder {
    color: var(--text-light);
    font-size: 10px;
}

.or-divider {
    text-align: center;
    font-size: 9px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.decode-btn {
    padding: 10px 16px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.decode-btn:hover {
    background: #5a7fb0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: var(--white);
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    color: var(--text-light);
    font-size: 13px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bento-digipin {
        grid-column: span 2;
    }

    .bento-qr {
        grid-column: span 1;
    }

    .bento-coords {
        grid-column: span 1;
    }

    .bento-map {
        grid-column: span 2;
        grid-row: span 1;
    }

    .bento-actions {
        grid-column: span 2;
        grid-row: span 1;
    }

    .bento-decode {
        grid-column: span 2;
    }

    .bento-copy {
        grid-column: span 1;
    }

    .bento-share {
        grid-column: span 1;
    }

    .action-buttons {
        flex-direction: row;
    }

    .action-btn {
        flex-direction: column;
        padding: 12px 8px;
    }

    .action-btn span {
        font-size: 11px;
    }

    .map-container {
        min-height: 150px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .bento-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .bento-item {
        padding: 14px;
    }

    .digipin-display {
        font-size: 20px;
        padding: 12px;
    }

    .digipin-display.placeholder {
        font-size: 12px;
    }

    .header {
        padding: 14px;
        margin-bottom: 16px;
    }

    .header img {
        width: 40px;
        height: 40px;
    }

    .header h1 {
        font-size: 18px;
    }

    .get-location-btn {
        padding: 14px 20px;
        font-size: 15px;
        margin-bottom: 16px;
    }

    .qr-container {
        padding: 4px;
    }

    .coords-display .lat-lng {
        font-size: 11px;
    }

    .single-action-btn svg {
        width: 22px;
        height: 22px;
    }

    .single-action-btn span {
        font-size: 10px;
    }

    .decode-input {
        font-size: 13px;
        padding: 10px 12px;
    }

    .decode-btn {
        padding: 10px 16px;
        font-size: 12px;
    }
}

/* Loading Animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading svg {
    animation: spin 1s linear infinite;
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}
