:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #4F46E5; /* Indigo / RT Yazılım Theme Base */
    --primary-hover: #4338CA;
    --secondary: #0ea5e9;
    --text-main: #f8f9fa;
    --text-muted: #94a3b8;
    --error: #ef4444;
    --success: #22c55e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Changed for scrolling content */
    position: relative;
    overflow-x: hidden;
    padding-bottom: 50px;
}

.background-shapes {
    position: fixed; /* Fixed so shapes don't scroll away */
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    top: 0;
    left: 0;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: float 25s infinite ease-in-out alternate;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -150px;
    left: -150px;
}

.shape-2 {
    width: 600px;
    height: 600px;
    background: var(--secondary);
    bottom: -200px;
    right: -150px;
    animation-delay: -5s;
}

.shape-3 {
    width: 400px;
    height: 400px;
    background: #6366f1;
    top: 30%;
    left: 50%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, -80px) scale(1.2); }
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    z-index: 1;
    margin-top: 40px;
    transition: max-width 0.4s ease;
}

.wide-container {
    max-width: 900px;
}

/* RT Yazılım Branding */
.logo-container {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 0.8s ease;
}

.brand-logo {
    max-height: 50px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.brand-logo:hover {
    transform: scale(1.05);
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
}

.header {
    text-align: center;
    padding: 30px 20px;
    margin-bottom: 25px;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.header p {
    color: var(--text-muted);
    font-size: 1rem;
}

.main-card {
    padding: 30px;
    margin-bottom: 30px;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

input {
    width: 100%;
    padding: 18px 20px 18px 50px;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    background: rgba(0,0,0,0.3);
    color: var(--text-main);
    font-size: 1.05rem;
    outline: none;
    transition: all 0.3s ease;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
    background: rgba(0,0,0,0.5);
}

input::placeholder {
    color: rgba(255,255,255,0.3);
}

.btn-primary {
    width: 100%;
    padding: 18px;
    border-radius: 16px;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    position: relative;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(79, 70, 229, 0.4);
    background: linear-gradient(135deg, var(--primary-hover), var(--secondary));
}

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

.loader {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    position: absolute;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* RESULTS & POST GRID SECTION */
.results-section {
    animation: fadeIn 0.5s ease;
}

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

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 30px;
    margin-bottom: 30px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.4);
}

.profile-info h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: #fff;
}

.profile-info p {
    color: var(--text-muted);
    font-size: 1rem;
}

.section-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 4px;
}

/* Pinterest / Instagram style Grid */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding-bottom: 30px;
}

.post-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--card-border);
    transition: all 0.3s ease;
}

.post-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card .overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.post-card .overlay i {
    font-size: 2.5rem;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.2);
}

.post-card:hover img {
    transform: scale(1.05);
}

.post-card:hover .overlay {
    opacity: 1;
}

/* Filter Tag on Post Card (e.g. Video Icon) */
.post-type-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    padding: 8px;
    border-radius: 50%;
    color: white;
    font-size: 1rem;
    z-index: 2;
}

/* MODAL DESIGN */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 0; /* Remove padding to make media full width in its section */
    display: flex;
    flex-direction: column;
}

@media(min-width: 768px) {
    .modal-content {
        flex-direction: row;
        height: 600px;
        overflow: hidden;
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 10;
    transition: color 0.3s;
    background: rgba(0,0,0,0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: var(--error);
    background: rgba(255,255,255,0.1);
}

.modal-body {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

@media(min-width: 768px) {
    .modal-body {
        flex-direction: row;
    }
}

.modal-media {
    flex: 6;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    position: relative;
}

.modal-media img, .modal-media video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal-info {
    flex: 4;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: rgba(255,255,255,0.02);
    border-left: 1px solid var(--card-border);
}

.modal-caption-container {
    margin-bottom: 20px;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Custom Scrollbar */
.modal-caption-container::-webkit-scrollbar {
    width: 6px;
}
.modal-caption-container::-webkit-scrollbar-track {
    background: transparent;
}
.modal-caption-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
}

.quote-icon {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 15px;
    display: block;
}

#modal-caption {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main);
    white-space: pre-wrap;
}

.error-msg {
    margin-top: 20px;
    padding: 16px;
    border-radius: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
}

.error-msg i {
    font-size: 1.2rem;
}

.footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--card-border);
    padding-top: 20px;
}

.footer a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 500;
}

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

.small-text {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 5px;
}

/* Responsive Grid */
@media(max-width: 600px) {
    .post-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
}
