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

@layer base {
    :root {
        direction: rtl;
    }

    body {
        @apply bg-slate-100;
        background-image: url('../images/body-bg.png');
        background-size: auto;
        background-position: center;
        background-repeat: repeat;
        background-attachment: fixed;
    }
}

@layer components {
    .btn-primary {
        @apply px-4 py-2 text-white bg-purple-600 rounded-lg shadow-md hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-2 focus:ring-offset-purple-200;
    }

    .form-input {
        @apply w-full px-3 py-2 text-sm border border-slate-200 rounded-lg focus:outline-none focus:border-slate-400 hover:border-slate-400;
    }

    .table-container {
        @apply relative flex flex-col w-full h-full overflow-hidden bg-white shadow-md rounded-lg;
    }

    .table-header {
        @apply p-4 text-sm font-normal text-right text-slate-500 bg-slate-50 border-b border-slate-300;
    }

    .table-cell {
        @apply p-4 text-sm border-b border-slate-200;
    }

    .table-row {
        @apply hover:bg-slate-50 transition-colors duration-150 ease-in-out;
    }

    .search-box {
        @apply relative w-full max-w-sm;
    }

    .search-input {
        @apply w-full pr-11 h-10 pl-3 py-2 bg-transparent placeholder:text-slate-400 text-slate-700 text-sm border border-slate-200 rounded transition duration-300 ease focus:outline-none focus:border-slate-400 hover:border-slate-400 shadow-sm focus:shadow-md;
    }

    .search-button {
        @apply absolute h-8 w-8 left-1 top-1 my-auto px-2 flex items-center bg-white rounded;
    }
}

body {
    font-family: 'Yekan', system-ui, -apple-system, sans-serif;
    margin-bottom: 60px;
}

html {
    position: relative;
    min-height: 100%;
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    white-space: nowrap;
    line-height: 60px;
}

/* RTL specific styles */
.navbar-nav {
    padding-right: 0;
}

.navbar-brand {
    margin-right: 0;
    margin-left: 1rem;
}

/* Custom styles for forms */
.form-control {
    text-align: right;
}

/* Custom styles for buttons */
.btn {
    margin-left: 0.5rem;
}

/* Custom styles for search box */
.search-box {
    direction: rtl;
}

/* Navbar customization */
.navbar.bg-primary {
    background-color: #0d6efd !important;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9);
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 1);
}

/* Form elements */
.form-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    border: 1px solid #e2e8f0;
    background-color: #fff;
    color: #1e293b;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Action buttons */
.action-button {
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.action-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.action-button.delete {
    color: #dc2626;
}

.action-button.edit {
    color: #2563eb;
}

/* Container */
.data-table-container {
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

/* Responsive */
@media (max-width: 640px) {
    .data-table-container {
        padding: 1rem;
    }

    .table-header {
        flex-direction: column;
        gap: 1rem;
    }

    .search-box {
        width: 100%;
    }
}

/* Numbers specific style */
.table td:contains('0'), .table td:contains('1'), .table td:contains('2'), 
.table td:contains('3'), .table td:contains('4'), .table td:contains('5'),
.table td:contains('6'), .table td:contains('7'), .table td:contains('8'),
.table td:contains('9') {
    font-family: 'Yekan', Tahoma, Arial, sans-serif;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Fix for table blue lines - remove double border */
.panel-info {
    border: none; /* Remove default border */
    margin-bottom: 20px;
}

.panel-info .panel {
    border: none; /* Remove panel border */
    border-radius: 0.5rem;
    overflow: hidden;
}

.panel-info .table {
    margin-bottom: 0; /* Remove margin to prevent double lines */
}

.panel-info .desktop-view {
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Remove extra borders from table header */
.panel-info .table thead th {
    border-top: none;
}

/* Keep only one clean border line */
.panel-info .table-striped {
    border: 1px solid #d9edf7;
}

/* Simplify panel-info styling overall */
.panel-info .shadow {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.08) !important;
}