/* css/common.css */

/*
 * Common styles shared across the entire site.
 * This includes root variables, body defaults, main layout containers,
 * the main header, and the main footer.
 */

:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --background-color: #f4f7f6;
    --container-bg: #ffffff;
    --text-color: #333;
    --border-color: #dee2e6;
    --header-height: 60px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    margin: 0;
    padding-top: var(--header-height); /* To prevent content from hiding behind the fixed header */
    color: var(--text-color);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Main Header Styles */
.main-header {
    background-color: var(--container-bg);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 1000;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease-in-out;
}

.main-header--hidden {
    transform: translateY(-100%);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; /* For absolute positioning of center welcome */
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
}

/* ====== HEADER CENTER WELCOME (reelsPage.php only) ====== */
.header-center-welcome {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: auto; /* Tıklamaya izin ver */
}

/* Kategori seçici stilleri */
.category-selector select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: white;
    font-size: 14px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    width: 200px;
}

.category-selector select:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Mobile responsive for header category selector */
@media (max-width: 768px) {
    .header-center-welcome {
        position: static;
        transform: none;
        left: auto;
        top: auto;
        margin-left: 10px;
        flex: 0.7;
        text-align: left;
    }
    
    .category-selector select {
        font-size: 12px;
        padding: 4px 8px;
        max-width: 120px;
        border-radius: 4px;
    }
}

/* Extra Small Mobile Devices */
@media screen and (max-width: 480px) {
    .category-selector select {
        font-size: 11px;
        padding: 3px 6px;
        max-width: 100px;
    }
    
    .header-center-welcome {
        margin-left: 5px;
    }
}

/* ====== REELS WELCOME TEXT (reelsPage.php only) ====== */
.reels-welcome-text {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap; /* Prevent text wrapping */
}

/* ====== PUBLIC LINKS WELCOME TEXT (index.php only) ====== */
.public-welcome-text {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap; /* Prevent text wrapping */
}

/* ====== HEADER HOME BUTTON (reelsPage.php only) ====== */
.header-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    border: 2px solid transparent;
    box-shadow: 0 3px 12px rgba(0, 123, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

/* Home icon styling */
.header-home-btn svg {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
    transition: all 0.3s ease;
    width: 18px;
    height: 18px;
}

/* Hover effects */
.header-home-btn:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 6px 20px rgba(0, 123, 255, 0.4),
        0 0 0 3px rgba(0, 123, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

/* Hover icon animation */
.header-home-btn:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Active/pressed state */
.header-home-btn:active {
    transform: translateY(-1px) scale(1);
    box-shadow: 0 3px 12px rgba(0, 123, 255, 0.3);
}

/* Focus accessibility */
.header-home-btn:focus {
    outline: none;
    box-shadow: 
        0 0 0 3px rgba(0, 123, 255, 0.3),
        0 3px 12px rgba(0, 123, 255, 0.3);
}

/* --- Styles for Header Global Actions --- */
.global-actions {
    display: flex;
    gap: 10px;
    margin-left: 20px; /* Space from logo */
}

.btn-global-toggle {
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 500;
    border-radius: 5px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.btn-global-toggle.images {
    background-color: #e8f4f8;
    color: #17a2b8;
    border-color: #b3e0eb;
}
.btn-global-toggle.images:hover {
    background-color: #17a2b8;
    color: white;
    transform: translateY(-1px);
}

.btn-global-toggle.videos {
    background-color: #fbeee4;
    color: #d35400;
    border-color: #f6dcc9;
}
.btn-global-toggle.videos:hover {
    background-color: #d35400;
    color: white;
    transform: translateY(-1px);
}

/* Hide mobile-specific text by default */
.btn-global-toggle .mobile-text {
    display: none;
}

.main-header nav {
    margin-left: auto; /* Push nav to the far right */
}

.main-header nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
}

.main-header nav ul li {
    margin-left: 20px;
}

.main-header nav ul li a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

.main-header nav ul li a:hover {
    color: var(--primary-color);
}

.main-header nav ul li span {
    color: #6c757d;
}

/* ====== BEAUTIFUL AUTH BUTTONS (Login & Register) ====== */
.auth-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none !important;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* Login Button - Light Blue Theme */
.login-btn {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0 !important;
    box-shadow: 0 3px 12px rgba(21, 101, 192, 0.2);
    border: 2px solid #2196f3;
}

/* Register Button - Light Green Theme */
.register-btn {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    color: #2e7d32 !important;
    box-shadow: 0 3px 12px rgba(46, 125, 50, 0.2);
    border: 2px solid #4caf50;
}

/* Auth Button Icons */
.auth-btn svg {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
    transition: all 0.3s ease;
}

/* Icon colors match text colors */
.login-btn svg {
    color: #1565c0;
}

.register-btn svg {
    color: #2e7d32;
}

/* Hover state icon colors */
.login-btn:hover svg {
    color: white;
}

.register-btn:hover svg {
    color: white;
}

/* Hover Effects */
.login-btn:hover {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 6px 20px rgba(33, 150, 243, 0.4),
        0 0 0 3px rgba(33, 150, 243, 0.1);
    border-color: #1976d2;
    color: white !important;
}

.register-btn:hover {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 6px 20px rgba(76, 175, 80, 0.4),
        0 0 0 3px rgba(76, 175, 80, 0.1);
    border-color: #388e3c;
    color: white !important;
}

/* Hover Icon Animation */
.auth-btn:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Active/Pressed State */
.auth-btn:active {
    transform: translateY(-1px) scale(1);
}

.login-btn:active {
    box-shadow: 0 3px 12px rgba(33, 150, 243, 0.3);
}

.register-btn:active {
    box-shadow: 0 3px 12px rgba(76, 175, 80, 0.3);
}

/* Focus Accessibility */
.login-btn:focus {
    outline: none;
    box-shadow: 
        0 0 0 3px rgba(33, 150, 243, 0.3),
        0 3px 12px rgba(33, 150, 243, 0.3);
}

.register-btn:focus {
    outline: none;
    box-shadow: 
        0 0 0 3px rgba(76, 175, 80, 0.3),
        0 3px 12px rgba(76, 175, 80, 0.3);
}

/* Pulse Animation Effect */
.login-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(33, 150, 243, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.6s ease;
}

.register-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(76, 175, 80, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.6s ease;
}

.auth-btn:hover::before {
    width: 120%;
    height: 120%;
    opacity: 0;
}

/* Home Icon Styles */
.home-icon-link a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.3s ease;
    background-color: transparent;
}

.home-icon-link a:hover {
    background-color: var(--primary-color);
    color: white !important;
    transform: translateY(-2px);
}

.home-icon-link svg {
    transition: all 0.3s ease;
}

/* Logout Icon Styles */
.logout-icon-link a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.3s ease;
    background-color: transparent;
}

.logout-icon-link a:hover {
    background-color: #dc3545;
    color: white !important;
    transform: translateY(-2px);
}

.logout-icon-link svg {
    transition: all 0.3s ease;
    color: #dc3545;
}

.logout-icon-link a:hover svg {
    color: white;
}

/* Main content area padding */
main.container {
    padding-top: 40px;
    padding-bottom: 40px;
}

/* Main Footer Styles */
.main-footer {
    text-align: center;
    padding: 20px 0;
    background-color: var(--container-bg);
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    color: #6c757d;
}

/* General button style, can be used site-wide */
.btn {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: var(--primary-hover);
}

/* --- Styles for User Info in Header --- */
.header-user-info {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    font-weight: 600;
}

.header-profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    border: 2px solid var(--border-color);
}

.header-user-info span {
    transition: color 0.2s ease;
    font-size: 16px; /* A bit smaller than the logo font */
}

.header-user-info:hover span {
    color: var(--primary-color);
}

/* Custom Confirmation Modal */
.modal {
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #f8f9fa;
    margin: auto;
    padding: 25px 30px;
    border: 1px solid #ddd;
    width: 90%;
    max-width: 450px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    animation: fadeIn 0.3s;
    text-align: center;
}

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

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
}

#custom-confirm-title {
    margin-top: 0;
    font-size: 22px;
    color: #333;
    margin-bottom: 15px;
}

#custom-confirm-message {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 25px;
}

#custom-confirm-message strong {
    font-weight: 600;
    color: var(--primary-color);
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn-danger {
    background-color: #dc3545;
}
.btn-danger:hover {
    background-color: #c82333;
}
.btn-secondary {
    background-color: #6c757d;
    color: white;
}
.btn-secondary:hover {
    background-color: #5a6268;
}

/* --- Responsive Design for Mobile --- */

/* Small screens (tablets and phones, less than 768px) */
@media screen and (max-width: 767px) {
    /* Adjust header height and body padding to make top bar narrower */
    body {
        padding-top: 50px; /* Adjusted for even smaller header */
    }

    .main-header {
        height: 50px; /* Adjusted for even smaller header */
        padding: 0 2px; /* Reduced horizontal padding */
    }

    /* Reduce size of user profile picture */
    .header-profile-pic {
        width: 30px; /* Smaller */
        height: 30px; /* Smaller */
        margin-right: 3px; /* Tighter margin */
    }

    /* Reduce font size of username */
    .header-user-info span {
        font-size: 13px; /* Smaller */
    }

    /* Reduce size and spacing of global action buttons */
    .global-actions {
        gap: 5px; /* Tighter spacing */
        margin-left: 15px; /* Increased space from username */
    }

    .btn-global-toggle {
        padding: 3px 7px; /* Az daha büyütüldü */
        font-size: 10px;  /* Az daha büyütüldü */
    }

    /* Add space to the left of the videos button on mobile */
    .btn-global-toggle.videos {
        margin-left: 8px;
    }

    /* Hide page title and shrink page actions on mobile */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .page-header h1 {
        display: none;
    }

    .page-actions {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 5px; /* Tighter gap */
    }

    #filter-category-select {
        padding: 3px 20px 3px 6px !important;
        font-size: 11px !important;
        flex-grow: 1;
    }

    .btn-filter, #add-link-btn {
        padding: 4px 5px !important;
        font-size: 10px !important;
        white-space: nowrap;
    }

    /* Adjust read-more toggle for mobile */
    .read-more-toggle {
        font-size: 1.4em !important;
        margin-left: 20px !important; /* More space on mobile to prevent accidental clicks */
        vertical-align: -2px !important; /* Fine-tune vertical position */
    }

    /* Reduce main container padding for more content space */
    main.container {
        padding-top: 25px !important; /* Reduced from 40px */
        padding-bottom: 25px !important; /* Reduced from 40px */
    }
    
    /* Increase container width on mobile for better space utilization */
    .container {
        width: 95% !important; /* Increased from 90% to 95% */
    }

    /* Reduce logo font size */
    .logo {
        font-size: 18px; /* Smaller */
    }

    /* Reduce nav link font size */
    .main-header nav ul li a {
        font-size: 14px; /* Smaller */
    }
    
    /* Home Icon - Mobile */
    .home-icon-link a {
        width: 28px;
        height: 28px;
        background-color: rgba(0, 123, 255, 0.1);
        border-radius: 6px;
        margin-right: 4px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .home-icon-link a:hover,
    .home-icon-link a:active {
        background-color: var(--primary-color);
        color: white !important;
        transform: scale(0.95);
        box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
    }
    
    .home-icon-link svg {
        width: 16px;
        height: 16px;
        color: var(--primary-color);
    }
    
    .home-icon-link a:hover svg,
    .home-icon-link a:active svg {
        color: white;
    }
    
    /* Logout Icon - Mobile */
    .logout-icon-link a {
        width: 28px;
        height: 28px;
        background-color: rgba(220, 53, 69, 0.1);
        border-radius: 6px;
        margin-left: 4px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .logout-icon-link a:hover,
    .logout-icon-link a:active {
        background-color: #dc3545;
        color: white !important;
        transform: scale(0.95);
        box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
    }
    
    .logout-icon-link svg {
        width: 16px;
        height: 16px;
        color: #dc3545;
    }
    
    .logout-icon-link a:hover svg,
    .logout-icon-link a:active svg {
        color: white;
    }
    
    /* Reels Icon - Mobile */
    .reels-icon-link a {
        width: 28px;
        height: 28px;
        background-color: rgba(255, 193, 7, 0.1);
        border-radius: 6px;
        margin-right: 4px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .reels-icon-link a:hover,
    .reels-icon-link a:active {
        background-color: #ffc107;
        color: white !important;
        transform: scale(0.95);
        box-shadow: 0 2px 6px rgba(255, 193, 7, 0.3);
    }
    
    .reels-icon-link svg {
        width: 16px;
        height: 16px;
        color: #ffc107;
    }
    
    .reels-icon-link a:hover svg,
    .reels-icon-link a:active svg {
        color: white;
    }

    /* Hide "LinkPages" text on mobile but show home icon */
    .logo a:not(.header-user-info),
    .home-link,
    .profile-link {
        display: none;
    }

    /* Show mobile text and hide desktop text on small screens */
    .btn-global-toggle .desktop-text {
        display: none;
    }
    .btn-global-toggle .mobile-text {
        display: inline; /* Or block, depending on desired layout */
    }
}

/* Extra Small Mobile Devices (max-width: 480px) */
@media screen and (max-width: 480px) {
    /* Home Icon - Extra Small Mobile */
    .home-icon-link a {
        width: 26px;
        height: 26px;
        margin-right: 3px;
        border-radius: 5px;
    }
    
    .home-icon-link svg {
        width: 14px;
        height: 14px;
    }
    
    /* Reels Icon - Extra Small Mobile */
    .reels-icon-link a {
        width: 26px;
        height: 26px;
        margin-right: 3px;
        border-radius: 5px;
    }
    
    .reels-icon-link svg {
        width: 14px;
        height: 14px;
    }
    
    /* Logout Icon - Extra Small Mobile */
    .logout-icon-link a {
        width: 26px;
        height: 26px;
        margin-left: 3px;
        border-radius: 5px;
    }
    
    .logout-icon-link svg {
        width: 14px;
        height: 14px;
    }
    
    /* Tighter spacing for very small screens */
    .main-header nav ul li {
        margin-left: 8px;
    }
}

body.no-scroll {
    overflow: hidden !important;
    position: fixed;
    width: 100vw;
    touch-action: none;
}

/* Mobile responsive for header home button */
@media (max-width: 768px) {
    /* Move welcome text to left on mobile */
    .header-center-welcome {
        position: static;
        transform: none;
        left: auto;
        top: auto;
        margin-left: 15px;
        flex: 1;
        text-align: left;
    }
    
    /* Adjust main header container for mobile */
    .main-header .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    /* Logo section adjustments */
    .logo {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-shrink: 0;
    }
    
    /* Navigation stays on the right */
    nav {
        flex-shrink: 0;
    }
    
    /* Welcome text mobile styles */
    .reels-welcome-text {
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 0.3px;
    }
    
    .public-welcome-text {
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 0.3px;
    }
    
    .header-home-btn {
        padding: 6px 10px;
        font-size: 12px;
        gap: 6px;
    }
    
    .header-home-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Mobile'da text gizle, sadece ikon */
    .header-home-btn span {
        display: none;
    }
    
    /* Mobile responsive for auth buttons */
    .auth-btn {
        padding: 4px 8px;
        font-size: 11px;
        gap: 4px;
    }
    
    .auth-btn svg {
        width: 12px;
        height: 12px;
    }
    
    /* Hide text on mobile, show only icons */
    .auth-btn span {
        display: none;
    }
    
    /* Adjust margins for mobile */
    .main-header nav ul li {
        margin-left: 12px;
    }
}

/* Extra small screens - centered welcome text */
@media (max-width: 480px) {
    /* Ultra small screens - shorter welcome text, still centered */
    .reels-welcome-text {
        font-size: 0; /* Hide original text */
    }
    
    .reels-welcome-text::after {
        content: "🎬 Video Reels";
        font-size: 12px;
        font-weight: 600;
        background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        letter-spacing: 0.3px;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .public-welcome-text {
        display: none; /* Hide public links text completely on mobile */
    }
    
    .public-welcome-text::after {
        display: none; /* Hide the after content as well */
    }
}