@tailwind base;
@tailwind components;
@tailwind utilities;

body {
    font-family: 'Vazir', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    direction: rtl;
    text-align: right;
}

.container {
    max-width: 1200px;
}

.tab-content {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
    opacity: 1;
}

.section {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.section.active {
    display: block;
    opacity: 1;
}

.widget-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

nav ul li a {
    transition: background-color 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Apply custom primary color */
button.bg-blue-500,
a.bg-blue-500 {
    background-color: <?php echo esc_attr(get_option('cup_settings')['primary_color'] ?? '#3b82f6'); ?>;
}

button.bg-blue-500:hover,
a.bg-blue-500:hover {
    background-color: <?php echo esc_attr(darken_color(get_option('cup_settings')['primary_color'] ?? '#3b82f6')); ?>;
}

/* Card styling for sections */
.section {
    @apply bg-white rounded-lg shadow-md p-6;
}

/* Icon styling */
nav ul li a:before {
    content: '';
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    background-size: cover;
}

nav ul li a[href="#profile"]:before {
    background-image: url('<?php echo CUP_URL . 'assets/icons/user.svg'; ?>');
}

nav ul li a[href="#orders"]:before {
    background-image: url('<?php echo CUP_URL . 'assets/icons/shopping-cart.svg'; ?>');
}

nav ul li a[href="#downloads"]:before {
    background-image: url('<?php echo CUP_URL . 'assets/icons/download.svg'; ?>');
}

nav ul li a[href="#tickets"]:before {
    background-image: url('<?php echo CUP_URL . 'assets/icons/ticket.svg'; ?>');
}

nav ul li a[href="#points"]:before {
    background-image: url('<?php echo CUP_URL . 'assets/icons/star.svg'; ?>');
}

/* Helper function to darken color */
<?php
function darken_color($hex) {
    $hex = ltrim($hex, '#');
    $r = hexdec(substr($hex, 0, 2));
    $g = hexdec(substr($hex, 2, 2));
    $b = hexdec(substr($hex, 4, 2));
    $r = max(0, $r - 20);
    $g = max(0, $g - 20);
    $b = max(0, $b - 20);
    return sprintf('#%02x%02x%02x', $r, $g, $b);
}
?>