/* Timestamp Tool Variables */
:root {
    /* Monokai Theme Colors */
    --monokai-bg: #272822;
    --monokai-fg: #f8f8f2;
    --monokai-comment: #75715e;
    --monokai-yellow: #e6db74;
    --monokai-purple: #ae81ff;
    --monokai-red: #f92672;
    --monokai-blue: #66d9ef;
    --monokai-green: #a6e22e;
    --monokai-orange: #fd971f;

    /* Liquid Glass Variables */
    --glass-bg: linear-gradient(135deg, rgba(45, 45, 45, 0.5) 0%, rgba(30, 30, 30, 0.4) 50%, rgba(45, 45, 45, 0.5) 100%);
    --glass-bg-solid: rgba(30, 30, 30, 0.4);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-border-top: rgba(255, 255, 255, 0.25);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    --glass-blur: blur(20px) saturate(200%);
    --glass-glow: 0 0 40px rgba(174, 129, 255, 0.08); /* Purple glow for timestamp tool */
}

/* Hide Global Navigation for this tool */
header.navbar-fixed,
#headNav,
#aplayer,
.aplayer {
    display: none !important;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #1a1a1a;
    color: var(--monokai-fg);
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    overflow-x: hidden;
    position: relative;
}

/* Background image layer with blur */
.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(12px);
    transform: scale(1.05);
}

/* Dark overlay for better contrast */
.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: rgba(0, 0, 0, 0.5);
}

.timestamp-tool-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    min-height: 100vh;
    box-sizing: border-box;
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
}

/* Liquid Glass Panel */
.glass-panel {
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-border-top);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--glass-shadow), var(--glass-glow);
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-sizing: border-box;
    position: relative;
}

/* Liquid glass shine effect */
.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 30%, 
        rgba(255, 255, 255, 0.4) 50%, 
        rgba(255, 255, 255, 0.3) 70%, 
        transparent 100%);
    pointer-events: none;
}

/* Inner glow effect */
.glass-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
    pointer-events: none;
    border-radius: 20px;
    z-index: 0;
}

/* Ensure content is above pseudo-elements */
.glass-panel > * {
    position: relative;
    z-index: 1;
}

.main-section {
    z-index: 10;
}

.tool-title {
    margin: 0 0 10px 0;
    font-size: 1.8rem;
    text-align: center;
    color: var(--monokai-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.section-title {
    margin: 0;
    font-size: 1.4rem;
    color: var(--monokai-blue);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

/* Section Label */
.section-label {
    font-size: 0.9rem;
    color: var(--monokai-green);
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}

/* Input sections */
.input-section {
    display: flex;
    flex-direction: column;
}

.input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
}

input[type="text"] {
    width: 100%;
    height: 50px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--monokai-fg);
    padding: 0 160px 0 16px;
    border-radius: 12px;
    font-family: 'Fira Code', monospace;
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

input[type="text"]:focus {
    border-color: var(--monokai-purple);
    box-shadow: 0 0 0 3px rgba(174, 129, 255, 0.2);
    background: rgba(0, 0, 0, 0.5);
}

.datetime-picker {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    border: none;
    padding: 0;
    top: 100%;
    right: 0;
}

/* Buttons */
.clear-btn,
.picker-btn,
.popover-trigger {
    position: absolute;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--monokai-fg);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.clear-btn {
    right: 170px;
}

.datetime-clear {
    right: 212px;
}

.popover-trigger {
    right: 170px;
}

.clear-btn:hover {
    background: rgba(249, 38, 114, 0.2);
    color: var(--monokai-red);
    border-color: rgba(249, 38, 114, 0.3);
}

.picker-btn:hover,
.popover-trigger:hover {
    background: rgba(102, 217, 239, 0.2);
    color: var(--monokai-blue);
    border-color: rgba(102, 217, 239, 0.3);
}

/* Action Buttons */
.action-buttons {
    display: none;
}

.action-btn {
    position: absolute;
    right: 10px;
    height: 38px;
    padding: 0 15px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    /* Adjust width if needed or let it auto-size */
    min-width: 140px;
}

.to-time-btn {
    background: linear-gradient(135deg, var(--monokai-purple), #9059ff);
    color: white;
    box-shadow: 0 4px 15px rgba(174, 129, 255, 0.4);
}

.to-time-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(174, 129, 255, 0.5);
}

.to-timestamp-btn {
    background: linear-gradient(135deg, var(--monokai-blue), #4ab3d2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 217, 239, 0.4);
}

.to-timestamp-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 217, 239, 0.5);
}

/* Timezone Grid */
.timezone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.timezone-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.timezone-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.country-flag {
    font-size: 2.5rem;
    line-height: 1;
}

.country-name {
    color: var(--monokai-comment);
    font-size: 0.9rem;
}

.country-time {
    color: var(--monokai-yellow);
    font-size: 1.2rem;
    font-weight: 600;
}

/* Code Blocks */
.code-block {
    background: #23241f; /* Slightly darker monokai bg */
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.code-lang {
    color: var(--monokai-comment);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.copy-code-btn {
    background: transparent;
    border: none;
    color: var(--monokai-comment);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--monokai-fg);
}

pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}

code {
    font-family: 'Fira Code', monospace;
}

/* Placeholder highlight for dynamic update */
.ts-placeholder,
.dt-placeholder {
    display: inline-block;
    background: rgba(174, 129, 255, 0.15);
    color: var(--monokai-purple);
    padding: 0 4px;
    border-radius: 4px;
    transition: all 0.3s;
}

/* Toast */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    background: rgba(35, 35, 35, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--monokai-fg);
    padding: 6px 16px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    font-weight: 400;
    font-size: 0.75rem;
    pointer-events: none;
    max-width: 280px;
    text-align: center;
}

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

.toast.error {
    border-color: rgba(249, 38, 114, 0.4);
    color: var(--monokai-red);
}

.toast.success {
    border-color: rgba(166, 226, 46, 0.4);
    color: var(--monokai-green);
}

/* Responsive */
@media (max-width: 600px) {
    .timestamp-tool-container {
        padding: 20px 15px;
    }
    
    .glass-panel {
        padding: 20px;
    }
    
    .tool-title {
        font-size: 1.4rem;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .action-btn {
        max-width: 100%;
    }
    
    .timezone-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Shadcn-style Date Picker CSS
   ========================================= */

.date-popover {
    display: none; /* Hidden by default */
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem; /* rounded-md */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    padding: 1rem;
    color: var(--monokai-fg);
    font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
    animation: popover-in 0.2s ease-out;
}

.date-popover.show {
    display: block;
}

@keyframes popover-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Calendar Header */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.current-month-display {
    font-size: 0.875rem; /* text-sm */
    font-weight: 500;
}

.cal-nav-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--monokai-fg);
    width: 28px;
    height: 28px;
    border-radius: 0.375rem; /* rounded-md */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.cal-nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Calendar Grid */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 0.25rem;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 0.75rem;
    color: var(--monokai-comment);
    font-weight: 400;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.calendar-day:hover:not(.empty) {
    background: rgba(255, 255, 255, 0.1);
}

.calendar-day.selected {
    background: var(--monokai-fg);
    color: #1a1a1a;
    font-weight: 600;
}

.calendar-day.today:not(.selected) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--monokai-purple);
    font-weight: 500;
}

.calendar-day.outside {
    color: rgba(255, 255, 255, 0.2);
}

.calendar-day.empty {
    cursor: default;
}

/* Time Selector */
.time-selector {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.time-selector input {
    width: 36px;
    height: 28px;
    padding: 0;
    text-align: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
    color: var(--monokai-fg);
    font-size: 0.875rem;
}

.time-selector input:focus {
    border-color: var(--monokai-fg);
    box-shadow: none;
}

.time-selector span {
    color: var(--monokai-comment);
}
