/* Base Variables & Design Tokens */
:root {
    --bg-base: #0a0a0c;
    --bg-surface: #121217;
    --bg-surface-elevated: #1a1a24;
    
    --accent-primary: #00ffcc;
    --accent-glow: rgba(0, 255, 204, 0.4);
    --accent-secondary: #7000ff;
    
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(0, 255, 204, 0.5);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Global Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-base);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

/* App Layout Setup */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
.sidebar {
    width: 320px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    position: relative;
    z-index: 10;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

/* Branding */
.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.logo-orb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    box-shadow: 0 0 15px var(--accent-glow);
    animation: float 3s ease-in-out infinite alternate;
}

@keyframes float {
    0% { transform: translateY(0px) scale(1); }
    100% { transform: translateY(-5px) scale(1.05); }
}

.brand h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 1;
}

.minimize-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.minimize-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.sidebar.minimized .minimize-btn svg {
    transform: rotate(180deg);
}

.sidebar.minimized .collapsible-content {
    display: none;
}

.brand span {
    color: var(--accent-primary);
    font-weight: 300;
}

/* Controls Area */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
}

.description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

textarea {
    width: 100%;
    padding: 1rem 1.2rem;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    resize: vertical;
    transition: var(--transition-smooth);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 255, 204, 0.2), inset 0 2px 4px rgba(0,0,0,0.2);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.8rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(0, 255, 204, 0.05);
}

.formatted-links {
    padding: 0 3rem 1.5rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1;
    position: relative;
}

.formatted-link-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(18, 18, 23, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition-smooth);
}

.formatted-link-item svg {
    color: var(--accent-primary);
}

.formatted-link-item:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 5px 15px rgba(0, 255, 204, 0.1);
    transform: translateX(5px);
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(0, 255, 204, 0.1), rgba(112, 0, 255, 0.1));
    border: 1px solid var(--accent-primary);
    border-radius: 12px;
    color: var(--accent-primary);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 204, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover {
    background: var(--accent-primary);
    color: #000;
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(1px);
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-primary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 255, 204, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(0, 255, 204, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 255, 204, 0); }
}

/* Main Gallery Area */
.gallery-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at center, var(--bg-surface) 0%, var(--bg-base) 100%);
    position: relative;
}

.gallery-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
    position: relative;
    z-index: 1;
}

.gallery-header h2 {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: 1.8rem;
    color: var(--text-primary);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    padding: 0.5rem;
}

.icon-btn.active, .icon-btn:hover {
    color: var(--accent-primary);
}

.gallery {
    flex: 1;
    padding: 0 3rem 3rem 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: 400px;
    gap: 2rem;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

/* Custom Scrollbar for Gallery */
.gallery::-webkit-scrollbar {
    width: 8px;
}
.gallery::-webkit-scrollbar-track {
    background: transparent;
}
.gallery::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}
.gallery::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* Iframe Card Styling */
.iframe-card {
    background: rgba(18, 18, 23, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: var(--transition-smooth);
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.iframe-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 15px rgba(0, 255, 204, 0.1);
    transform: translateY(-5px);
}

.card-header {
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
}

.card-url-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    flex: 1;
    margin-right: 0.5rem;
    overflow: hidden;
}

.lock-icon {
    color: var(--accent-primary);
    opacity: 0.8;
}

.card-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: monospace;
}

.card-actions {
    display: flex;
    gap: 0.25rem;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 28px; height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.action-btn.close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.iframe-wrapper {
    flex: 1;
    position: relative;
    background: #ffffff; /* White background for framed sites */
}

.iframe-wrapper::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 30px; height: 30px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 0;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s;
}

iframe.loaded {
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        padding: 0 2rem 2rem 2rem;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
        height: auto;
    }
    
    .app-layout {
        flex-direction: column;
        height: auto;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        padding: 1.5rem;
        box-shadow: 0 4px 20px rgba(0,0,0,0.5);
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
    }
    
    .brand {
        margin-bottom: 1rem;
    }
    
    .brand h1 {
        font-size: 1.1rem;
    }

    .minimize-btn {
        display: flex;
    }
    
    .gallery-container {
        height: auto;
        min-height: 100vh;
    }
    
    .gallery-header {
        padding: 1.5rem;
    }
    
    .gallery-header h2 {
        font-size: 1.4rem;
    }
    
    .formatted-links {
        padding: 0 1.5rem 1rem 1.5rem;
    }
    
    .gallery {
        padding: 0 1.5rem 1.5rem 1.5rem;
        grid-template-columns: 1fr;
        grid-auto-rows: 450px;
        height: auto;
        overflow-y: visible;
    }
    
    .status-indicator {
        display: none; /* Hide status in mobile to save space */
    }
}

